MSBuild 找不到参考

MSBuild cannot find a reference(MSBuild 找不到参考)
本文介绍了MSBuild 找不到参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我目前正试图弄清楚为什么 MSBuild 无法编译我们的单元测试 dll 之一.该问题仅出现在此 DLL 中,而不出现在其他单元测试项目中.

I'm currently trying to figure out why MSBuild is not able to compile one of our unit test dlls. The problem is only occuring with this DLL and not with the other unit test projects.

这是构建失败时我从 TeamCity 收到的输出:

This is the output I receive from TeamCity when the build fails:

[10:38:55]: NAnt output:
[10:38:55]: [exec]
[10:38:55]: [exec]
[10:38:55]: [exec] "C:Robinson	runkProjectsRobinsonRobinson.sln" (default target) (1) ->
[10:38:55]: [exec] "C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj" (default target) (19) ->
[10:38:55]: [exec] (CoreCompile target) ->
[10:38:55]: [exec] ModulesSecurityModuleTests.cs(10,30): error CS0234: The type or namespace name 'Modules' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] ModulesSecurityModuleTests.cs(197,39): error CS0246: The type or namespace name 'SecurityModule' could not be found (are you missing a using directive or an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] TranslateTests.cs(10,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] IPETests.cs(8,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] PagesBasePageTest.cs(6,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] PagesBasePageTest.cs(7,30): error CS0234: The type or namespace name 'Pages' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] ServiceAsmxTests.cs(9,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] ServiceAsmxTests.cs(10,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] PagesBasePageTest.cs(16,17): error CS0246: The type or namespace name 'basepage' could not be found (are you missing a using directive or an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec] ServiceAsmxTests.cs(22,17): error CS0246: The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?) [C:Robinson	runkProjectsRobinsonTenForceExecutionTestsTenForceExecutionTests.csproj]
[10:38:55]: [exec]
[10:38:55]: [exec] 2075 Warning(s)
[10:38:55]: [exec] 10 Error(s)
[10:38:55]: [exec]
[10:38:55]: [exec] Time Elapsed 00:01:40.06

TenForceExecutionTests 项目是一个简单的 DLL,其中包含 MBunit 框架的多个单元测试.该项目对 TenForceExecution 的引用是一个 Web 应用程序项目,另一个对 TenForce.Execution.Test 的引用,这是另一个包含两个项目逻辑的 DLL.

The project TenForceExecutionTests is a simply DLL that contains several UnitTests of the MBunit Framework. This project has a reference to TenForceExecution which is a web application project and another reference to TenForce.Execution.Test, which is another DLL containing logic for both projects.

当我们在开发机器上编译所有东西时,它可以正常工作并且编译不会出错.然而,在构建代理上,这似乎失败了......

When we compile everything on the development machine, it works without problems and the compile occurs without errors. On the build agent however this seems to fail...

信息

  • 目标框架:.NET4
  • 操作系统:Windows XP 32 位
  • 已安装 Windows 7 SDK

编辑

做了一个干净的检查,Visual Studio 能够构建整个解决方案,但是 msbuild 不能.

Did a clean checkout, and Visual Studio is able to build the entire solution, msbuild however cannot.

编辑 2

检查了依赖关系:

  • 项目之间存在项目依赖关系
  • 项目之间存在解决方案依赖关系

编辑 3当我删除对 webApplication 项目的引用,并将其替换为对该项目的已编译 DLL 的引用时,错误消失并且项目可以使用 MSBuild 正常编译.

EDIT 3 When I remove the reference to the webApplication project, and replace it with a reference to the compiled DLL of that project, the errors dissapear and the project compiles fine with MSBuild.

编辑 4我已经从 msbuild 通过 LOG 运行了整个构建,并查看了编译出现问题的项目的具体任务:

EDIT 4 I've ran the entire build from msbuild through a LOG and took a look at the specific task for compiling the project that's giving problems:

  Task "Csc"
    c:WindowsMicrosoft.NETFrameworkv4.0.30319Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsASP.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonBULinDebugBUL.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonBULTestinDebugBULTest.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonDALinDebugDAL.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonFrameworkinDebugFramework.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsGallio.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsIesi.Collections.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonLanguageResourceinDebugLanguageResource.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentslog4net.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsMbUnit.dll /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0mscorlib.dll" /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsNHibernate.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonPresentationBridgeinDebugPresentationBridge.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonPresentationBridgeTestinDebugPresentationBridgeTest.dll /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Configuration.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Core.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Data.dll" /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsSystem.Data.SQLite.DLL /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Web.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Web.Extensions.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Web.Services.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Xml.dll" /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonTenForce.Execution.TestinDebugTenForce.Execution.Test.dll /reference:D:Usersarne.de.herdt.TENFORCE2DocumentsRobinsonSourceProjectsRobinsonThirdPartyComponentsWatiN.Core.dll /debug+ /debug:full /optimize- /out:objDebugTenForceExecutionTests.dll /target:library ModulesSecurityModuleTests.cs TestRunSetup.cs TranslateTests.cs WebBaseTest.cs MetaTests.cs IPETests.cs PagesBasePageTest.cs PropertiesAssemblyInfo.cs ServiceAsmxTests.cs Settings.Designer.cs "D:Usersarne.de.herdt.TENFORCE2AppDataLocalTemp6.NETFramework,Version=v4.0.AssemblyAttributes.cs"
    Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
    Copyright (C) Microsoft Corporation. All rights reserved.

据我所知,实际的 WebApplication包含在参考列表中.

From what I can tell, the actuall WebApplication is NOT included in the reference list.

推荐答案

显然这似乎是 MSBuild 中的一个已知问题,因为越来越多的人对此有疑问.我仍然没有收到 Microsoft 对此的有效回复,但这里继续讨论:http://social.msdn.microsoft.com/Forums/en-CA/msbuild/thread/434abf1a-30db-4b13-8062-13755898dd71

Apparently this seems to be a known problem in MSBuild as more people have issues with this. I still haven't received a valid reply from Microsoft regarding this, but the discussion was continued here : http://social.msdn.microsoft.com/Forums/en-CA/msbuild/thread/434abf1a-30db-4b13-8062-13755898dd71

这篇关于MSBuild 找不到参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
quot;File has a different computed hash than specified in manifestquot; error when signing the EXE(“文件的计算哈希值与清单中指定的不同签署EXE时出错)
Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI?(良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 MSBuild 脚本?)
Run an MSBuild target only if project is actually built(仅在实际构建项目时运行 MSBuild 目标)
MS-Build BeforeBuild not firing(MS-Build BeforeBuild 未触发)
Using C# 7.1 with MSBuild(将 C# 7.1 与 MSBuild 结合使用)