How to open files with differnet application having the same extension - visual-studio

How does Windows determine the application to start when I double-click on an associated file?
I installed Visual Studio 2013 on my PC and converted an existing solution from version 2008 to 2013.
Interesting, when I double click on a solution in 2008 format it opens VS 2008, for a 2013 it opens VS 2013. That's fine but how does Windows know? All solution files have the same extension .sln, so there must be another way to define the opening application in this case.

The following texts from this post should address your concern:
When you double-click on a .sln file, a small program called vslauncher.exe is called with the path to your .sln file as its first argument. The job of vslauncher.exe is to read enough of your .sln file to determine which version of Visual Studio to use to open your file. Since you may have several versions of Visual Studio installed (VS2003, 2005, 2008, Express SKUs, etc.) you probably want to open the solution with the same copy of Visual Studio that you used to create it.
Visual Studio 2008 .sln files typically start with these two lines:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
That said, if your .sln file signature (the first two lines of your file) does match any known release of Visual Studio, it will be opened by that particular VS version.

Related

Open visual studio project in its respective version instead of Visual Studio 2017

Ever since I installed Visual Studio 2017, it now wants to be the one to open all of my projects. Before installing 2017, if I double clicked a VS 2010 .csproj or .sln in Explorer (Windows 10), it would open in VS 2010. But now opening a project for all previous versions opens in 2017. Even if I right-click and choose Open With > Microsoft Visual Studio Version Selector it always chooses 2017. To open it in the correct version of Visual Studio, I have to first open VS and then browse to the project to open. This is a pain when I don't remember which version the project should open with and just want to click it and open it. Can I reset it to open a project in the version of visual studio it belongs with?
I confirmed how this is meant to work with the team. The only requirement is that you set Microsoft Visual Studio Version Selector as the Default App for .SLN files in Windows. That app launches the version of Visual Studio specified in the solution file. If you crack open a .sln file in an editor, you'll see a section that specifies the version of VS that should be used. It'll look something like this:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.25909.2
One thing to keep in mind though is that value will change whenever a different version of Visual Studio writes to the solution file. E.g., if you create a solution in VS 2010, close VS 2010, launch VS 2017, open the same solution, add a project to it (this is what forces VS to make a change to the .sln file), the version in the solution file will then change to VS 2017. I.e., the last version of VS to write to the solution file, will be set as the version to be used when opening it.
If you're finding it's not working as described, we likely have a bug here. Let me know if that's what you think is happening.

Visual Studio 2010 Ultimate how to create executable file

I have visual studio 2010 ultimate. There is no option to make executable file.
So how can I make executable files using this version of visual studio.
Actually you've already created an .exe file by "building" your code that you tested in debugger mode. However your .exe file may require other files in order to deploy it onto another P/C. I recommend you read this information at the following link;
click here to go on link
Other than that you can actually find a copy of your current executeable in your application folders debug folder. May take a little searching. I'm using Visual Studio 2012 RC and I don't know if the file structure is the same for Visual Studio 2010 but for the application "counter" I look in "C:\Users\John\Documents\Visual Studio 2012\Counter\Counter\obj\Debug\Counter.exe.

Are Visual Studio 2008 and Visual Studio 2012 solutions"compatible"?

I edited my project (which was written in school using Visual Studio 2008) at home using Visual Studio 2010 Express. When I got back to school, I couldn't open my solution anymore as Visual Studio 2008 told me that the file was created with a newer version of Visual Studio. I asked my professor for help and he edited something in the assembly information of the solution and voila, I could open, run, edit it again as nothing ever happened.
However, I forgot what he did with the assembly information. Does anyone here know what he could have done? or is this approach not advisable?
At the top of the .sln file there would be a line:
Microsoft Visual Studio Solution File, Format Version 11.00
If you change the version to 10.00, it would correspond to Visual Studio 2008. Use any text editor for this.
The file format has not changed in between these versions (nor has it for Visual Studio 2012).
Edit the .sln file in Notepad and find the version number (11.0) on the first or second line. Change it to 10.0, save the file, and you should be good to go.

How exactly does "Visual Studio Version Selector" chooses a Visual Studio version?

For extensions like .sln or .csproj, the default application is Microsoft Visual Studio Version Selector. I've got two versions installed, 2010 SP1 and 2012 RC. How exactly will this application decide which VS to launch?
I would say that it works like this:
If it finds any hint in the given file which version should be used, then it uses it. For example, at the top of .sln files there is something like this so the Version Selector can decide:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
If it doesn't find any hint it will use whichever version was later installed (in my case I reinstalled 2010 SP1 after 2012 was already installed on my PC and now I think that VS2010 is opened more often than 2012 but am not 100% sure).
This is my feeling but what are the exact rules?
There are some version info in the file header. Otherwise it would not be possible for the file explorer to display different document icon on the .sln file with a number:
representing .sln files for VS versions 2008/2010/2012/2013/2015/2017/2019/2022
This number on the icon disappears if you edit the .sln file with notepad or some other text editor that does not preserve the UTF-8 signature (see comment by Paul Groke). In this case also the version selector cannot choose the right version, and you cannot open it from the file explorer. You can specifically open it from within Visual Studio and save the .sln file to fix it. Also see this for more on this issue.
The .sln file must be a UTF-8-BOM file and it must start like this:
[blank line]
Microsoft Visual Studio Solution File, Format Version XX.XX[XXX...]
[description]
The [description] is for example # Visual Studio Express 2012 for Windows Desktop for VS 2012 or # Visual Studio 15 for VS 2017.
The second line is case sensitive but the third line (description) is not. If it is missing, the Selector seems to start the latest VS.
The VisualStudioVersion entry is ignored.
However, for the right file icon to be displayed, the [description] has to be exact and case sensitive.
Open your solution in the right Visual Studio version. Click to select the solution. Click File --> Save xxx.sln.

Using microsoft chess in visual studio 2010

I want to use microsoft chess framework in visual studio 2010. it works fine in 2008 but its support is not available for visual studio 2010. is there any way to use it.
Just go there: CHESS: Systematic Concurrency Testing Source Code, click on the 'Download' button, read the licence text and if you're ok download the full package somewhere on your disk.
From there you can just extract the whole .ZIP file and open the All.Sln file at the root of the extracted files, it's a Visual Studio 2010 solution.

Resources