我用这行代码用msbuild编译.net 3.5解决方案:
msbuild.exe n:\temp\Thisnight.sln /p:Configuration=Debug /v:diag
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
error CS0234: The type or namespace name 'UnitTesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
我已经获得了VS2010自身构建的最新资源(当然).
似乎无法弄清楚我在这里缺少什么....
编辑
在命令窗口中看到更高的此消息:
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.
Run Code Online (Sandbox Code Playgroud)
我不认为我必须通过我的项目包含这个DLL(因为它是一个MS DLL吗?)
编辑我现在看到的:所有项目都是针对.Net 3.5框架的,但是testproject(给我带来问题的那个)是针对.Net 4.0框架的.奇怪的是:我无法改变它.
这是一个vs2010的网络解决方案.webservice,winforms,dll,setup和testprojects
如果您查看 Microsoft.Common.Targets 文件,您将看到:
<!--
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)
-->
Run Code Online (Sandbox Code Playgroud)
VS 在自己的环境中运行 MSBuild,我也不知道其中的差异,但是您是否尝试通过修改 AssemblyFolders 项在命令行中添加缺少的程序集路径。您在这里有一个教程:http://www.beefycode.com/post/Resolving-Binary-References-in-MSBuild.aspx。
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
4522 次 |
| 最近记录: |