VS2011 code analysis
c++, code-analysis, visual-studio-2012
Solution
I think only VS2010 Ultimate supports code analysis. I don't have VS2012 but I think you should edit the vcxproj file manually.
Look for one or both of these params if they exist inside your project file: `<RunCodeAnalysis>true</RunCodeAnalysis>` and `<EnablePREfast>true</EnablePREfast>`
Change both values to `false` and it should work.
Please note that these names are used by VS2010 and I am unsure if they changed it in VS2012.
Problem
I recently installed the VS2011 beta to get a feel for the new C++11 features Microsoft had implemented in the latest release of their compiler. I've had an unexpected problem when going back to use VS2010 though. I've opened a Windows SDK 7.1 sample project in VS2010. Now when I build in VS2010, I get the following output, denoting that a code analysis tool is being executed (seemingly after compilation, but before linking) ``` 1>------ Rebuild All started: Project: MFCaptureToFile, Configuration: Debug Win32 ------ 1> winmain.cpp 1> capture.cpp 1> Running Code Analysis for C/C++... 1>capture.cpp(112): error C2220: warning treated as error - no 'object' file generated 1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString' 1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 98, 103, 105 1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString' 1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 336, 338, 340, 343, 351, 353 1>C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\ks.h(53): error C2220: warning treated as error - no 'object' file generated 1>c:\program files\microsoft sdks\windows\v7.1\include\ks.h(53): warning C6244: Local declaration of 'GUID_NULL' hides previous declaration at line '28' of 'c:\program files\microsoft sdks\windows\v7.1\include\cguid.h' 1> Generating Code... ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== ``` I've attempted to determine what change to the project has caused code analysis tool to be executed, but I can't find anything in the project properties. I've tried reloading the project in VS2011, but there's no option for code analysis that I can turn off (as suggested on MSDN). The project is completely native C++, I've never used C++ with CLR Further, I've tried opening other projects (my own) and now they're also invoking this code analysis stage. This prevents building due to problems with Microsoft code in many cases! Builds seem to succeed in VS2011 beta. Can anyone offer insight into how to turn this code analysis tool off? I would hope to leave VS2011 beta installed, so please refrain from suggesting uninstalling it, unless it's the only option!