共用方式為


How to open a Windows Phone .sln file in Visual Studio 2010 Professional instead of Visual Studio 2010 Express for Windows Phone

Question:

I have a Windows Phone project that was created by somebody else, and when I double-click on the .sln file, it opens in Visual Studio 2010 Express for Windows Phone.  I have Visual Studio 2010 Professional installed and would prefer to use that for my Windows Phone development scenarios.  How can I force Windows Phone .sln file to open in Visual Studio 2010 Professional instead of Visual Studio 2010 Express for Windows Phone?

Answer:

In your scenario, the .sln was originally created in the Visual Studio 2010 Express for Windows Phone edition.  The general philosophy used by Visual Studio is to try to open a .sln in the exact edition that it was originally created in, and then to fall back to other supported Visual Studio editions in the same product family if that exact edition is not installed.

There are a few options you can use to cause a Windows Phone .sln file to open in Visual Studio 2010 Professional by default.

Option 1 – Update the metadata in the .sln file

You can open the .sln file in a text editor such as Notepad and change the following value at the top of the file:

# Visual Studio 2010 Express for Windows Phone

To cause the .sln to open in Visual Studio 2010 Professional by default, change the above line to the following:

# Visual Studio 2010

After you change that value and save and close your .sln file, double-clicking on the .sln will cause it to attempt to be opened in Visual Studio 2010 Professional (or Premium or Ultimate) if that edition is installed on your computer.  It will still fall back to trying the express edition if Visual Studio 2010 Professional is not installed.

Note – when using this option, you will have to change the metadata in every .sln file that you want to change the default behavior for.

Option 2 – Update the default verb handler for the .sln extension

You can right-click on a .sln, choose Open With, then Choose Default Program.  It is usually set to the Microsoft Visual Studio Version Selector by default.  You can browse to the Visual Studio 2010 version of devenv.exe and force the computer to open .sln files with Visual Studio 2010 Professional instead of the version selector.

This option will change the behavior for all .sln files opened on the computer, including .sln files created in other Visual Studio product families (such as Visual Studio 2005 or 2008).  This option typically does not work well if you have multiple Visual Studio editions from different product families installed side-by-side and you regularly use .sln files from multiple Visual Studio product families on the same computer.

Option 3 – Rename the vpdexpress.exe program

You can rename the Visual Studio 2010 Express for Windows Phone executable (vpdexpress.exe), and this will cause the Visual Studio version selector to think that the express edition is not installed.  That will cause the .sln to open in Visual Studio 2010 Professional even if the metadata in the .sln file says that the .sln file was created with the express edition.

This option is the most invasive, but allows you to avoid needing to update each .sln file, and it does not affect the ability to open .sln files created with other Visual Studio product families.

Comments

  • Anonymous
    March 12, 2011
    I'm participating in the ODNC WP7 study group, and ran into this!  Annoying how I get pinged to get a license key!  DOH!  Anyways, thank you very much for your solution!  I picked option #3. I hope you don't mind, but I blogged about it too!  Yes, I did give you credit! haha www.pchenry.com/.../Given-a-WP7-Express-solution-but-want-to-open-in-YOUR-VS-2010.aspx

  • Anonymous
    April 13, 2011
    I don't have the express edition so I cannot try this. But couldn't you simply drag and drop the solution file in the professional edition? This should work. Umesh

  • Anonymous
    April 13, 2011
    Hi Umesh - Yes, you can always directly open a .sln or project file directly in Professional.  The focus of this blog post was on how to change the double-click behavior for a .sln file though, so that's why I didn't specifically list that option here.