Upgrade Visual Studio 2013 solutions to Visual Studio 2015 - visual-studio

I have installed both Visual Studio 2013 and Visual Studio 2015. Projects and solutions that were created in VS2013 are opened by VS2013 as I would expect, but I would like to be able to upgrade those files so that they would be opened by VS2015 when double clicked.
How can I upgrade solution files that are in VS2013 format so that the Microsoft Visual Studio Version Selector will open them in VS2015?

The simplest solution IMO (also worked for 2012 and 2013) is:
Open the solution file using Visual Studio 2015
Select the solution file in Solution Explorer
Select File / Save MySolution.sln As...
Overwrite the existing solution file.

Change the version in the .sln file
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
To match whatever version you have
As of this morning my VS Enterprise is 14.0.23107.0
Example:
# Visual Studio 2015
VisualStudioVersion = 14.0.23107.0
Visual Studio 2015 Update 3 is 14.0.25420.1

Note: This works for VS 2015 and 2017
An alternative to hand-editing the .sln file or re-saving on top of the original .sln file:
Open the solution in Visual Studio
Right click solution > Add > New Solution Folder (name does not matter)
Save solution
Delete the newly added solution folder
Save solution
The solution will now be upgraded.

I ran across this looking for the same thing. The accepted answer works, but I noticed some comments about not being batchable. I found an option for batching and I thought I'd share.
You can use the /upgrade option in devenv.com. This means it's batchable. For example, to recurse the current directory upgrading all .sln files (after backing them up), you could do this:
dir -Recurse -path ".\" *.sln | ForEach-object {
Copy-Item $_.FullName "$($_.DirectoryName)\$($_.Name.Remove($_.Name.Length - $_.Extension.Length)).vs2013$($_.Extension)";
& "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" /upgrade $_.FullName
}

I solved the problem by this: Right click on solution, "Retarget solution".(vs2013)

The other solutions here didn't work for me. My project was created in Visual Studio 2012, and I am now using Visual Studio 2015, but this should work if you're going from 2013 to 2015. This is how you manually upgrade a project from a earlier version to a newer one:
Open the Developer Command Prompt for VS2015 (to find it: https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx)
Type in devenv SolutionFile | ProjectFile /upgrade and press enter
Where SolutionFile | ProjectFile is the full path with filename of your .sln file.
https://msdn.microsoft.com/en-us/library/w15a82ay.aspx

Related

How to Enable WiX Projects in Visual Studio 2017

In Visual Studio 2017's New Project dialog, there is no entry for Windows Installer XML (WiX).
Is it possible to enable WiX projects in Visual Studio 2017?
You can manually enable Visual Studio 2017 compatibility with WiX 3.10 or earlier:
Close all instances of Visual Studio.
Copy
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\WiX to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\WiX
(In the destination path, replace "Enterprise" with "Professional" or "Community" depending on your edition.)
You may need to provide Administrator permission:
The result will look like this:
Copy C:\Program Files (x86)\MSBuild\Microsoft\WiX to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\WiX
Then execute the following command as Administrator:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv" /setup
(Again, replace "Enterprise" with "Professional" or "Community" depending on your edition.)
When you open Visual Studio 2017, WiX 3.10 and earlier projects will be compatible.
WiX v3.11.0.1507 provides full support for the VS 2017 Extension For WiX.
The Release Notes provide insight into why it has taken so long to provide the extension and compatibility with the extension and older versions of WiX
Note: You can use the "WiX Toolset Visual Studio 2017 Extension" with previous versions of the WiX Toolset but there is a forwards compatibility issue when building managed custom actions that is only fixed in the WiX v3.11 RC release. In other words, if you have managed custom actions and you want to use VS 2017 then you must upgrade to WiX v3.11 RC.
Edit:
The VS 2019 Extension is now available.
Edit:
The VS 2022 Extension is now available.
The Wix Releases Page has links to the other extensions.
I found that I also had to copy the WiX folder from "C:\Program Files (x86)\MSBuild\Microsoft" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft". Without this, I got an error trying to load my WiX project that one of the MSBuild targets files couldn't be found.
WiX now offers support for Visual Studio 2017.
All you have to do is:
Close Visual Studio 2017
Install the WiX Toolset Build Tools
Install the WiX Toolset Visual Studio 2017 Extension
The answer by Chris works, but on my machine, for some reason, the Wix folder in "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\WiX" had only one template named "CustomActionCPP.zip". I had to search for a complete Wix folder in other older versions of Visual Studio. It worked for me by copying Wix from "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\WiX\ProjectTemplates".
Also, had to apply the answer by Basim, by copying Wix from "C:\Program Files (x86)\MSBuild\Microsoft" to "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft".
I have installed ONLY VS2017 and had to copy from another machine where VS2015 was installed the mentionen folder of #Chris Schiffhauer. The same for the folder of #Basim mentioned.
Addiontally I had to copy the "C:\Program Files (x86)\Wix Toolset 3.10\" because when I have installed WiX on my machine in this folder were still some assemblies missing.
Install the Wix Toolset Visual Studio 2019 Extension and reload the project
right-click the project folder in the path and uncheck the read-only
after install the Extension reload the Wix
use the below URL download
https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension

Change build tools from VS2010 to VS2015 in command line

I want to upgrade a solution in command line, so that I can build that solution / the projects within that solution with VS 2015. But somehow that does not work like expected.
What I am doing
1) Download the source code from https://ssl.icu-project.org/repos/icu/icu/tags/release-56-1/
2) Calling vcvarsall.bat for VS 2015.
3) Changing the ToolsVersion for every project
for /r "%cd%" %%a in ( *.vcxproj ) do (
sed.exe -i "s/ToolsVersion=\"4\.0\"/ToolsVersion=\"14\.0\"/g" "%%a"
)
4) Upgrade solution
rem upgrade solution
devenv "allinone\allinone.sln" /Upgrade
But nonetheless, I get warnings like this:
warning : The build tools for Visual Studio 2010 (v100) cannot be
found. To build using the Visual Studio 2015 (v140) build tools,
either click the Project menu or right-click the solution, and then
select "Upgrade Solution...". Install Visual Studio 2010 (v100) to
build using the Visual Studio 2010 (v100) build tools.
What I am missing? Is there a way how this can be done withing command line / batch ?
You must add this:
<PropertyGroup><PlatformToolset>v140</PlatformToolset><PropertyGroup>
Source: used vs2015 to upgrade the projects and checked the diffs
The ToolsVersion you changed refers to msbuild I think. The PlatformToolset is what changes the compiling toolchain.
In the Visual Studio 2015 environment, right click the solution in the Solution Explorer View, and choose "Retarget solution".

visual studio cannot open new project

Whenever I try to create a new project in VS 2010 I get the error:
New project/item dialog could not be initialized due to error:
Exception of type 'Microsoft.VisualStudio.Dialogs.DialogInitializationException' was thrown.
And when try to open existing project visual studio 2010 restarts.
I had the same problem on my computer. After a long time searching I solved it by the following steps:
Close all instances of Visual Studio
Go to "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE" (or whatever is your VS installation directory)
Run command devenv.exe /resetuserdata and wait until finished
Run Visual Studio
I can't find the former case. As you met an exception
Microsoft.VisualStudio.Dialogs.DialogInitializationException
I am suggesting you try the way below:
Run devenv /resetuserdata.
Delete the file:
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\ComponentModelCache
and restart Visual Studio.
Close all VS instances and try the solution mentioned here:
Launch Developer Command Prompt for VS 2017 as Administrator
Go to VS 2017 installation folder, for example: pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll
Open your control panel
Change
Regional -> Formats tab -> Format: English(United States)
https://connect.microsoft.com/VisualStudio/feedback/details/727578/vs-do-not-work-with-finnish-number-format-on-w8-64-bit
It works for me :)
This problem can cause when you install an older version of Visual Studio nearby the current version. For example VS 2017 is installed on your system and you do force install of VS 2008.
I faced this problem many years ago by installing VS 2008 after VS 2010;
and today again I had this problem. Because I installed SolidWorks 2015 after VS 2017. SolidWorks had a Visual Studio 2008 inside its package that interferes my installation.
Just uninstalled VS 2008 and I'm done.
I found this to still be an issue in Visual Studio Community 2017, Microsoft released a work around that fixed my problem:
The work-around for this issue would be:
-Launch “Developer Command Prompt for VS 2017” as Administrator
-Go to VS 2017 installation folder, for example: pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
-gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll

How does Windows know what version of Visual Studio a .sln file relates to?

If I have a VS 2005 solution then it shows up as "Version: Visual Studio 2005". If I have a VS 2010 solution, the sln file shows up as related to that.
Both of them have a .sln suffix. So how does Windows know which version of VS to open it with?
It uses Property Handler and Icon Handler shell extensions (part of the Visual Studio Version Selector)
These are registered by the registry key HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln (referenced by HKEY_CLASSES_ROOT\.sln)
When you open the file, it runs "c:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1", which reads the version from the .sln file and open the correct version.

How can I delete bad Visual Studio templates?

How do you remove the following noise templates that don't even work?
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
To save a bit of time for 2010 users, the folder has moved:
...\My Documents\Visual Studio 2010\Templates\ProjectTemplates
For Visual Studio 2013, I found my template cache here:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\12.0\ProjectTemplatesCache
Deleting them off of disk should do the trick. Where they exist will depend a bit on where you installed them. If you installed them for all users they will be at
%ProgramFiles%\Microsoft Visual studio 9.0\Common7\Ide\ProjectTemplatesCache
For a single user they will be at
%USERPROFILE%\Visual Studio 2008\Templates\ProjectTemplates
EDIT
If InstallVSTemplates fails, it is likely one of the following. The one I can't help with is some program randomly dumping files inside of the ProjectTemplatesCache directory.
The other more likely cause is there is a bad template in the ProjectTemplates directory. InstallVSTemplates really just goes through this directory, and unzips all of the files into the ProjectTemplatesCache directory. You will have to search through this directory and find the .zip file which contains the junk files being added to your project Once you find the file, delete it, delete ProjectTemplatesCache, and then re-run InstallVSTemplates.
After manually searching for some of the custom profile templates(.vstemplate),I found them at the following location:
%userprofile%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions
It appears VS2010 installs some of the templates as extesions or the authors made it that way.I hope this helps someone.
May need to run "devenv /setup" at the run command to refresh the VS2010 after you delete the templates.
For me it was a matter of removing it from here using VS2017:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\15.0_45552a03\ProjectTemplatesCache
Delete the bad/unwanted project folders from
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
Clear cache
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache
Delete stuff from (perhaps not necessary)
C:\Users[Your User Name]\Documents\Visual Studio 2008\Templates\ProjectTemplates
and finally open Visual Studio 2008 Command Prompt as Administrator and run
devenv /installvstemplates
For me the issue got resolved when I deleted the cache.bin file from ItemTemplatesCache folder. Full path of this folder is:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
Also make sure you delete the template files from below locations:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
C:\Users\Default\Documents\Visual Studio 2010\Templates\ItemTemplates
C:\Users[NT-USERNAME]\Documents\Visual Studio 2010\Templates\ItemTemplates
For Visual Studio 2019:
Extensions > Manage extensions > Installed > Uninstall
Worke for VS 2012 and 2015 :
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
worke in VS 2019 :
1- In VS2019, custom templates can be removed by deleting the template folder from %USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio{VSVersion}\ProjectTemplatesCache. Look for a {VSVersion} that begins with "16".
https://i.stack.imgur.com/V6SQ5.png
2- Delete What You Want From Templates Folder in {C:\Users\USERName\Documents\Visual Studio 2019\My Exported Templates}
Notes :
{ProjectTemplatesCache} Or {ItemTemplatesCache}
https://i.stack.imgur.com/9BM9p.png
For Visual Studio Express 2010 you should delete all folders under
%USERPROFILE%\AppData\Local\Microsoft\VCSExpress\10.0\Extensions
For Visual Studio 2013 Community, you have to delete {program folder}\Common7\IDE\ItemTemplatesCache\cache.bin after deleting all the unwanted files as described above. Afterwards VS will rebuild the templates listing in the New Project... dialog.
You could also try this:
dotnet new --uninstall <PATH|NUGET_ID>
It works for me in VS 2019 and VS 2022 to uninstall the Avalonia templates.
Description
The dotnet new --uninstall command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number.
Examples
Uninstall the Avalonia templates
dotnet new --uninstall Avalonia.Templates
From MicrosoftDocs
If the template was installed by double clicking a VSIX file, it is considered an extension and can be uninstalled using the technique described by Hamid Behnam above. Otherwise, it can be deleted from one of the template directories mentioned above.
It looks like in each case we use different recipe. Unfortunately, commands line and VS menu command listed in this thread did not work in my case, which is MS VS 2019 Community Edition on Win7 x64:
First, close VS, remove unwanted *.zip files from all following folders, as well as hidden cache.bin file from the last \ProjectTemplatesCache folder (it will be restored at VS startup), then restart VS. Here are those 3 folders:
{Documents}\Visual Studio 2019\My Exported Templates
{Documents}\Visual Studio 2019\Templates\ProjectTemplates
{User}\AppData\Roaming\Microsoft\VisualStudio{Number}\ProjectTemplatesCache

Resources