Visual Studio 2012 error: Package 'Visual C++ package' failed to load - visual-studio-2012

When I'm trying to open any solutions that worked fine before in Visual Studio 2012, the error "Package 'Visual C++ package' failed to load" keeps showing up. And the solution can't be opened.
I'm not sure what's wrong with my Visual Studio 2012 installation.

click the TOOLS--->VISUAL STUDIO COMMAND PROMPT to open the command window
input the command "devenv /Setup"
open the visual studio 2012 again, it will works.
Source: http://happyivyli.blogspot.com/2013/07/visual-c-package-failed-to-load.html

Running command prompt from inside Visual Studio.
For easier access, you can add the Visual Studio Developer Command Prompt or any other command prompt to the Tools menu on Visual Studio, by adding it to the external tools list. This is how you can accomplish that:
Open Visual Studio.
Select the Tools menu and choose External Tools...
On the External Tools dialog box, choose the Add button. A new entry appears.
Enter a Title for your new menu item such as Command Prompt.
In the Command field, specify the file you want to launch such as %comspec% or C:\Windows\System32\cmd.exe.
In the Arguments field, specify where to find the specific command prompt you want to use such as /k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" (this will launch the Developer Command Prompt installed with Visual Studio 2015). This value needs to be changed according to your Visual Studio version and installation location.
Choose a value for the Initial directory field such as Project Directory.
Choose the OK button.
After that, the new menu item is added and you can access the command prompt from the Tools menu.
Then:
Right-click the Visual Studio icon
Choose Run As Administrator
Click the menu TOOLS → *Command Prompt** to open the command window
Input the command "devenv /Setup"
Open Visual Studio again, and it will work.

None of the solutions I found around, including those listed here, seemed to help. What did work was going in the software install/uninstall management, right clicking on Visual Studio and choosing "change" (that's where you would normally uninstall something from).
That should pop up the Visual Studio package manager, and from there you can choose repair.
In my case, looking at the systems backlog and restore points, it seems it was one of the Visual C++ redistributables, possibly installed by some game, that compromised the environment.
This is on Windows 8.

Possibly same fix as this https://stackoverflow.com/a/21266545/990618
Check your User environment variables for VCHOME, VCINSTALLDIR and vsinstalldir.
Change
X:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\
to
X:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
Or
X:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\
depending VS 2012 or 2013.

Related

What Azure permission does a programmer need to run Visual Studio 2019?

I have Visual Studio 2019 installed on an Azure machine and every time I run it, it asks for username and password which I enter. It then says Elevation is required. The System Admin grants this but it is only for 15 mins. What permission do I need to be able to run VS19 without permission or elevation? Systems Admin doesn't know either.
Run Visual Studio as an administrator follow these steps to open the IDE:
NOTE: These instructions are for Windows 10. They are similar for other versions of Windows.
Open the Start menu, and scroll to Visual Studio 2019.
From the right-click or context menu of Visual Studio 2019, select More > Run as administrator.
When Visual Studio starts, (Administrator) appears after the product name in the title bar.
You can also modify the application shortcut to always run with administrative permissions:
Open the Start menu, scroll to the version of Visual Studio that you're using, and then select More > Open file location.
In File Explorer, locate the Visual Studio shortcut for the version that you're using. Then, right-click the shortcut and select Send to > Desktop (create shortcut).
On the Windows desktop, right-click the Visual Studio shortcut, and then select Properties.
Select the Advanced button, and then select the Run as administrator check box.
Select OK, and then select OK again.
For reference follow this Visual Studio 2019 troubleshoot
Or, When it shows elevation is required ,
Please close the VS Installer and try running it as administrator from start menu.
Or trying to run
C:\Program Files (x86)\Microsoft VisualStudio\Installer\vs_installer.exe directly.

Opening Project from TFS Dashboard causes Visual Studio Web Handler Exception

I'm trying to open a project from TFS 2018 (on-premises installation but I guess that would happen with any version or VSTS as well) dashboard but I can't.
I click on url Open in Visual Studio:
And an error form shows up:
The error description says:
Input args:/openurivsweb://vs/Product=Visual_Studio&EncFormat=UTF8&tfslink=dnN0ZnM6Ly8vRnJhbWV3b3JrL1RlYW1Qcm9qZWN0L2I1MjI0OWRjLTdhMDUtNDI1Yi1iZTE5LWNmMDM5YzE1YTJlND91cmw9aHR0cHM6Ly90ZnMubWFucG93ZXIuaXQvTmV4dEcv
Exception thrown:'Microsoft.VisualStudio.VSWebHandler.VSWebHandlerException'.
I have installed both VS2012 and 2017.
I tried also this workaround, but with no success:
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
Launch command: gacutil -if Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll
In the Windows Default Apps panel open the protocol handlers and scroll down to the vsweb: and the vstfs: protocol handlers. It could have multiple instances of the handler, one of which has to have the 2017 icon. Mine is showing 2 2017 icons because I have the 2017 preview installed side by side.
Change the default, restart the browser and try again.
In addition to jessehouwing answer, that works for Windows Metro UI systems (8 and superiors), this is what you need for Windows 7.
Go to Control Panel, select Default Programs and click the second option:
Then it opens the window where you have to change the association between Visual Studio Web Handler Selector and TFS Procotol Handler (vstfs:):
From the icon, as suggested, you can see that's Visual Studio 2012 symbol.
Now we change it:
Sorry bout Italian language, but procedure would be the same with any localization.

Visual studio in Administrator mode

my visual studio is not opening in administrator mode on opening a project by clicking a solution. By default i set it as run as administrator. but, still it is not opening if i directly open the project by clicking the project solution file.
If you open Visual Studio, right-click on the Taskbar icon of it, and select Properties.
In the tab Shortcut, press the Advanced button and tick 'Run as administrator'. Click OK.
In the tab Compatibility, tick the 'Run this program as an administrator' option. Click OK.
Apply and close the properties dialog.
I changed those settings on my computer and it always starts in administrator mode.
This is a copy of my answer to a similar post on SuperUser:
Option 1 - Set VSLauncher.exe and DevEnv.exe to always run as admin
To have Visual Studio always run as admin when opening any .sln file:
Navigate to C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe.
Right-click on VSLauncher.exe and choose Troubleshoot compatibility.
Choose Troubleshoot program.
Check off The program requires additional permissions and hit Next.
Click the Test the program... button to launch VS.
Click Next, then hit Yes, save these settings for this program, and then the close buton.
To have Visual Studio always run as an admin when just opening visual studio directly, do the same thing to the DevEnv.exe file(s). These file are located at:
Visual Studio 2010
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Visual Studio 2012
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Visual Studio 2013
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
Visual Studio 2015
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
Option 2 - Use VSCommands extension for Visual Studio
Install the free VSCommands extension for Visual Studio (it's in the Visual Studio Extensions Gallery) and then configure it to always have Visual Studio start with admin privileges by going to Tools -> VSCommands -> Options -> IDE Enhancements -> General and check off Always start Visual Studio with elevated permissions and click the Save button.
Note: VSCommands is not currently available for VS 2015, but their site says they are working on updating it to support VS 2015.
My Opinion
I prefer Option 2 because:
it also allows you to easily turn off this functionality.
VSCommands comes with lots of other great features so I always have it installed anyways.
it's just easier to do than option 1.

How to choose which version of Visual Studio gets pulled up by default?

I have VS 2012 and 2013 installed on my system.
I have a 2012 project that I want to get pulled up in VS 2013 when I double-click it from the Windows Explorer.
Is this possible?
If you only want specific slns to open in 2013, you can open the sln file in a text editor, and change the line
# Visual Studio 2012
to
# Visual Studio 2013
Note that it will ask you to upgrade the projects to 2013 when you open it for the first time. If you want all of 2013's compiler features you will have to upgrade, but if you chose not to it will still load in the 2013 IDE and you get some of the IDE related features.
Right click any solution file and select Open with... option. Use Visual Studio Version Selector as the default program to use for Visual Studio solution files.

How to use MSBuild to target v110 platform toolset?

I am developing a command line application that creates a full Visual Studio 11 solution made of a single VC++ project and that tries to compile it in the end using MSBuild.
The problem I am facing is strange.
If I execute my command line program inside Visual Studio 11 it works; if I instead launch it outside the development environment it throws me the error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(511,5): error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected. [f:\ABC.vcxproj]
The command I am using is the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe f:\snake\W9A30040.vcxproj /property:PlatformToolset=v110;Configuration=Debug /v:quiet
But I have the feeling that PlatformToolset=v110 is ignored and MSBuild use v100 (Visual Studio 2010).
Do you have any suggestions how to tell MSBuild to compile for v110 Platform Toolset?
I ran into the same problem as well with the full release of VS 2012. You can also set the VisualStudioVersion as a property with MSBuild as opposed to dealing with environment variables as mentioned in the accepted answer. For instance:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe .\myproject.vcxproj /p:VisualStudioVersion=11.0
The environment variables approach I'm sure work just as well, I honestly didn't try that as I was trying to stay away from having to modify the environment variables.
Make sure that the top of your .SLN file looks like this:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
When you double-click on the solution file, it's the # Visual Studio 2012 that controls which version of Visual Studio is loaded (and controls the icon displayed in Windows Explorer).
However, when you run MSBuild, it looks at the Format Version 12.00 part.
Confused?
This is confusing, since Visual Studio 2010 is version 10.0 and Visual Studio 2012 is version 11.0 (not 12.0), and using the version 12.0 solution file format causes MSBuild to (implicitly) set VisualStudioVersion to 11.0.
I found a workaround for this issue; could be a problem of Visual Studio 11 Beta that will be resolved before official release.
Anyway, if you are interestedm just set the environment variable "VisualStudioVersion" equal to "11.0" before calling MSBuild.exe.
In batch files
set VisualStudioVersion=11.0
or in VB.NET
Environment.SetEnvironmentVariable("VisualStudioVersion", "11.0")
Starting with Visual Studio 2013, MSBuild is now part of Visual Studio, and the correct path should be $(MSBuildToolsPath) (“C:\Program Files (x86)\MSBuild\12.0\Bin”). If you use msbuild.exe from the .Net framework folder (“C:\Windows\Microsoft.NET\Framework64\v4.0.30319”) it will not able to distinguish the vs2012 and vs2013 versions.
Use the menu based options to do this. From VC++2010 Express:
- Right click on the main file of the project (not the solution itself at the very top of the tree).
- Click General.
- Find Platform Toolset on the right side of the dialog, top half.
- Change from v110 to v100.
- Click OK.
----- Done ------
Microsoft provides a batch file to set all the EnvVars
You find it in the Start Menu under "Microsoft Visual Studio 2012/Visual Studio Tools" or in the Visual Studio folder ("C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat")

Resources