1

I am trying to run the code analysis of Visual Studio 2015 on my x64 VC++ project. However I get the following error:

Error   C1250   Unable to load plug-in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\bin\localespc.dll'

I am activating the x64 toolset of Visual Studio by running the batch script "vcvarsall.bat amd64" before I start the IDE. Visual Studio is run with the "/useenv" option afterwards.

When I check the VC++ environment variables, I can see that the following path is contained in the PATH variable:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64

How can I tell Visual Studio to use the code analyzer (localespc.dll) from there and not the x86 version which it apparently tries to use (according to the error message).

Thanks a lot for your help!

Manuel S.
  • 13
  • 5

2 Answers2

1

I was having the same issue with my 64-bit C++ projects. I discovered simply renaming/removing localespc.dll from VC\bin allowed the Code Analysis builds to succeed and still report analysis warnings. It seems if VS doesn't find this dll in the VC\bin directory then it won't add the compiler switch for /analyze:plugin but otherwise passes all the other switches required by the Code Analysis.

G2_Robot
  • 56
  • 5
1

Set the following property in your project file: <PreferredToolArchitecture>x64</PreferredToolArchitecture>

This tells Visual Studio to use the 64-bit version of various tools, including code analysis. I found How to make Visual Studio use the native amd64 toolchain helpful on the topic.

Note that renaming localespc.dll no longer solves the problem with Visual Studio 2017. It seems that setting PreferredToolArchitecture is Microsoft's intended way to do this.

Stefan R.
  • 11
  • 1
  • 2
  • This did not work for me on VisualStudio 2017 but the link you posted has a note about using `true>` which did work. – J'e Nov 03 '21 at 18:23