3

我正在使用 TFS2012 进行 VS2012 Update 3。

我使用 devenv 和 msbuild 构建了相同的解决方案。当我进入网站项目时,devenv 不会报告任何错误,但 msbuild 会反复报告。两者的日志示例:

开发者:

114>------ Build started: Project: C:\...\API\, Configuration: Debug Any CPU ------  
114>Could not get dependencies for project reference 'A'Could not get dependencies for     project reference 'BusinessLogic' Could not get dependencies for project reference 'BusinessLogic.ASPAgents' Could not get dependencies for project reference 'DataAccessLogicComponents' Could not get dependencies for project reference 'UI'Validating Web Site
114>Building directory '/API/'.  
114>  
114>Validation Complete

微软构建:

121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\A\bin\Release\A.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  
121>C:\Scrubbed\API.metaproj : warning MSB3274: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  
121>C:\Scrubbed\API.metaproj : warning MSB3275: The primary reference "C:\Scrubbed\PreMVC\BusinessLogic\bin\Release\A.Web.BusinessLogic.dll" could not be resolved because it has an indirect dependency on the assembly "A, Version=0.0.0.15, Culture=neutral, PublicKeyToken=060d385c0c45e767" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".  

     C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /API -p PreMVC\API\ -u -f PrecompiledWeb\API\ 

121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
121>C:\Scrubbed\PreMVC\API\App_Code\File1.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
121>C:\Scrubbed\PreMVC\API\App_Code\File2.cs(12): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(7): error CS0234: The type or namespace name 'BusinessLogic' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]
121>C:\Scrubbed\PreMVC\API\App_Code\File3.cs(8): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'A.Web' (are you missing an assembly reference?) [C:\Scrubbed\API.metaproj]  
121>Done Building Project "C:\Scrubbed\API.metaproj" (Rebuild target(s)) -- FAILED.

关于为什么 Devenv 继续但 MSBuild 立即失败的任何想法?

4

3 回答 3

2

我从 MSDN 论坛上的一个模组得到了答案。基本上,MSBuild 对 devenv 只是发出警告但继续执行的依赖关系非常严格。

我们最终获得了完全迁移到 .NET 4.5 的许可,因此我们修复了不匹配问题并最终将构建迁移到了 MSBuild。

于 2014-01-24T17:31:50.887 回答
0

您的日志中的警告没有说明问题吗?

“121>C:\Scrubbed\API.metaproj : 警告 MSB3274: 主要参考“C:\Scrubbed\PreMVC\A\bin\Release\A.dll”无法解析,因为它是针对“.NETFramework, Version=v4.5" 框架。这是比当前目标框架".NETFramework,Version=v4.0" 更高的版本。"

于 2014-01-24T12:18:18.997 回答
0

确保将项目引用添加到其他项目,并且它们都使用相同版本的 .NET 框架。

于 2014-01-23T20:49:28.357 回答