Make VS 2012 the default exe for .cs, .config, etc files - visual-studio

So I have both VS 2010 and 2012 installed, and we are mostly migrated to 2012 now. However, the default association for .cs files, and .config files, etc is still VS2010. So, if I double-click on a loose .cs file, or a loose, .config file, etc, VS2010 opens.
I know how to change file associations piecemeal, but is there a way to have Visual Studio migrate the default exe for all vs file types over to 2012?
BTW: The solution detection stuff is working fine -- a 2012 solution goes to 2012, and a 2010 to 2010 -- it's all the other individual file types that are still associated with 2010.

There are a number of ways to accomplish this, but I recommend doing this within Visual Studio 2012:
Tools > Options > Environment > General > Manage File Associations
Alternative Solution:
Another way would be right clicking on the file in File Explorer, then using Choose default program...

Related

How to open a Visual Studio Code Folder (Project) in Visual Studio IDE

How do I open I a Visual Studio Code folder in Visual Studio 2015?
If I open it as a "Web Site", it tries to treat the node_modules directory as part of the project's normal JavaScript files and hits an error when the path exceed the maximum path length.
But I can't open it as any other project type unless I first create a project of that type and then move all the VS Code files into that folder.
Should I be trying to open it as a web site?
Or should I create a new project and then copy the files + folders into it?
Is there any advantage to having it as a project?
If I do create a project, it makes it difficult to work together with someone who is just using VS Code?
And if I use a project, which project type should I select?
Finally folder view has arrived in VS 2017 :)
You can find more details in here.
Currently there is no way to open a folder directly with Visual Studio.
Why? Because Visual Studio and Visual Studio Code only shared their name, not the idea behind it. To extend Jenny O'Reilly answer:
Visual Studio Code is a folder oriented editor
This means VSC has the same Point-of-View to your Project as the File Explorer.
Visual Studio (not Code) is a solution oriented integrated development environment (short IDE)
Instead every Project in Visual Studio needs a *.sln Solution-File as Root Component. From this point Visual Studio looks at your Project. An example would, if you copy File in your Project Folder, they wouldn't be recognized from Visual Studio. You have to add them first to your sln File, to see them. It also allows the developer to combine multiple projects (*.csproj,..) into one single Solution to build.
This means the idea behind these two editors is completely different.
Visual Studio (not code) Project-types for Web
There are Node.js Tools for Visual Studio
This will provide Node.js built-in project templates
Visual Studio 2015 comes with TypeScript templates
Workaround 1
A workaround would be a Blank Solution in which you set up your Visual Studio Code Project.
Workaround 2
Another trick would be the answer to this question. You can open your Project Folder as a Website Project.
File -> Open Website -> File System and choose the folder
Update
As you mentioned, there will be errors because Visual Studio tries to build the solutions. For the next few readers of this response, the work around for this (as John Pankowicz writes in the comment) is:
Right-click Web Site in Solution Explorer -> Property Pages -> Build -> Uncheck "Build Web Site as part of solution"
Update 2
(Thanks to JC1001 for this update)
The next version of Visual Studio (Visual Studio "15") will support opening a folder. This is mentioned in the Visual Studio Blog.
Also like in Visual Studio Code, there will be a prompt command for opening Folders. Right now you can use this in the preview version:
devenv /command “file.openfolder FOLDER_PATH”
In the future you will be able to use:
devenv FOLDER_PATH
Opinion
Personally I wouldn't recommend Visual Studio (not code) for HTML/Website projects without server-side-development, because I don't see any features. Even the intellisense suggests to me sometimes bad HTML Code (it's not the IDE's fault).
After all web projects are still text files. You can easily control group projects like this with Version Control. Visual Studio Code even provides an integrated Git support.
Visual Studio Code does not create "project files" that you can open in Visual Studio 2015. Basically, when you open up a Node website in Visual Studio, you need to re-create the folder structure in VS2015 and create a "project file".
I haven't seen any better ways of doing this, but will be happy when we can open a folder just as easilly as we can with VSCode
I'm sure it's not the best way but..
Open an existing .sln with notepad, change the names, save as [name of your project].sln.
Open with Visual Studio.

What determines the default startup project?

I have a open source project that include Visual Studio project files. There is a solution file with four projects files. When the source files are distributed and unpacked, Visual Studio picks the wrong project as the default project. New users don't know they need to right click a certain project, and then select Set as Startup Project.
I've tried re-ordering the projects in the solution file so the appropriate project is first, and I tried changing the UUID on the appropriate project so its the lowest. Neither have helped with the problem of Visual Studio selecting the wrong startup project.
The Visual Studio versions I test against are Visual Studio 2005, 2008, 2010, 2012, 2013 and 2015.
What determines the default startup project?
What can I do to ensure Visual Studio selects the correct startup project?
A related question is Why is “Set as Startup” option stored in the suo file and not the sln file?, but it asks "Why..." and does not ask "How To...".
If there is a *.suo file, the Startup Project is saved there.
Otherwise, the first project listed in the *.sln file will be the Startup.
(tested with VS 2013)

How to open files with differnet application having the same extension

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.

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.

Visual studio 2010 solution explorer settings

I got a fairly large (C++) project in Visual studio 2010. Somehow I managed to click "Show all files" in the solution explorer and now a bug in visual studio 2010 is preventing me from uncheck the option.
http://connect.microsoft.com/VisualStudio/feedback/details/614417/visual-studio-crashes-when-switching-solution-explorers-view
Do anyone here know where the this setting is stored? I've searched the solution file, project files, filter files without finding anything.
For C#, similar user-specific data is stored in SolutionName.suo (hidden) and ProjectName.csproj.user files. See if you have what might be the equivalent files for C++. You can freely delete these files to reset user-specific settings, which should restore solution explorer to its default view.
In addition to those programming in C++, for VS 2010 C++ these files are:
ProjectName.suo
ProjectName.vcxproj.user

Resources