I am moving a project from Visual Studio 2010 to Visual Studio 2012 and am getting compiler errors about VSConstants:
Error 16 The name 'VSConstants' does not exist in the current context
I have ensured that Microsoft.VisualStudio.Shell is referenced and have also tried referencing Microsoft.VisualStudio.Shell.11.0 and Microsoft.VisualStudio.Shell.10.0. I have checked that the .cs file is using the assembly as well (using Microsoft.VisualStudio.Shell).
Any ideas on how to get VSConstants in Visual Studio 2012? If not, is there an equivalent in Visual Studio 2012 that I could use? I’m currently using VSConstants.E_FAIL and VSConstants.E_NOINTERFACE.
Thanks!
Make sure you have the VS 2012 SDK installed from http://www.microsoft.com/en-au/download/details.aspx?id=30668
You need to add
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.11.0.dllas a reference to the projectTo use that assembly you will have to target the 4.5 framework.
Alternatively, The project I just upgraded … all I needed to do was to change the framework version to 4.5 and delete the project references it couldn’t find. I had anticipated that ReSharper would point me at the new ones but it just built anyway. Note, this was after I installed the SDK.