Tuesday, 27 November 2007

Code analysis, VSLangProj and EnvDTE

If you have a Visual Studio add-in that references the VSLangProj assembly, that assembly implicitly refererences the EnvDTE assembly (version 7.0.3300.0). However that version of EnvDTE doesn't ship with VS2008.

There is a binding redirect in place for Visual Studio (via a devenv.exe.config file), but this doesn't appear to work for the Code Analysis command. I tried modifying the fxcopcmd.exe.config file to no avail.

The is the error I'm seeing:

Running Code Analysis...
C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe  /outputCulture:1033 /out:"bin\Debug\Altinoren.ActiveWriter.Dsl.dll.CodeAnalysisLog.xml" /file:"bin\Debug\Altinoren.ActiveWriter.Dsl.dll" /dictionary:"..\CodeAnalysisDictionary.xml" /directory:"C:\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies" /directory:"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies" /directory:"C:\Windows\Microsoft.NET\Framework\v2.0.50727" /directory:"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies" /directory:"C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\Assemblies" /directory:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" /rule:"C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Rules" /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /timeout:120
MSBUILD : error : CA0001 : The following error was encountered while reading module 'Altinoren.ActiveWriter.Dsl': Assembly reference not resolved: EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
MSBUILD : error : CA0058 : The referenced assembly 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found. This assembly is required for analysis and was referenced by: 'Altinoren.ActiveWriter.Dsl.dll'.
Code Analysis Complete -- 2 error(s), 0 warning(s)

Update 29th November 2007:

David Kean has responded to my query in the MSDN forums with a workaround to this problem.

1 comment:

Vivek G said...

Please let me know whats the solution for this.
Does it affect in deploying the site?
I think it does...
Is there anyone with right resolution.