开发者

doing msbuild from the command line: getting errors for the referenced namespace 'Microsoft.VisualStudio.TestTools'

i'm compiling a .net 3.5 solution with msbuild with this line of code:

msbuild.exe n:\temp\Thisnight.sln /p:Configuration=Debug /v:diag

and it gives me this error:

 error CS0234: The type or namespace name 'UnitTesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' 开发者_高级运维(are you missing an assembly reference?)

i've gotten the latest source which (off course) builds in VS2010 itself.

Can't seem to figure out what i'm missing here....

EDIT

Seeing higher up in the command window this message:

  C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference.
 Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutra
l, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

I don't think i have to include this DLL by my project (because it's a MS dll?)

EDIT What i've seen now: all projects are for the .Net 3.5 framework, but the testproject (which is the one giving me problems) is for the .Net 4.0 framework. And the weird thing is: i can't change it.

It's a vs2010 solution with web. webservice,winforms,dll,setup and testprojects


did you run vcvars32.bat in your cmd shell?


If you look at the Microsoft.Common.Targets file you will see :

<!--
    The SearchPaths property is set to find assemblies in the following order:

        (1) Files from current project - indicated by {CandidateAssemblyFiles}
        (2) $(ReferencePath) - the reference path property, which comes from the .USER file.
        (3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
        (4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
            The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
        (5) Registered assembly folders, indicated by {Registry:*,*,*}
        (6) Legacy registered assembly folders, indicated by {AssemblyFolders}
        (7) Resolve to the GAC.
        (8) Treat the reference's Include as if it were a real file name.
        (9) Look in the application's output folder (like bin\debug)
    -->

VS runs MSBuild in its own environment, I don't know the differences either but did you try adding the lacking assembly path in command line by modifying the AssemblyFolders items. You have a tuto here : http://www.beefycode.com/post/Resolving-Binary-References-in-MSBuild.aspx .

Hope this helps.


try running:

msbuild /version

Make sure it's the 3.5 version and not something older.

Make sure the MS dll is here, or somewhere like that:

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜