Tfs生成失败

本文关键字:失败 Tfs | 更新日期: 2023-09-27 17:58:40

我在TFS生成控制器中配置了项目,但在队列新生成后,我面临生成失败的问题。在日志中,当我签入所有文件时,我发现缺少引用的错误。

如何调试和创建精细的tfs构建zip。

生成失败。

   "C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp.sln" (default target) (1) ->
   "C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj" (default target) (2) ->
   (ResolveAssemblyReferences target) -> 
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Optimization". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth.Consumer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId.RelyingParty, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "WebGrease". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     C:'Windows'Microsoft.NET'Framework64'v4.0.30319'Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Antlr3.Runtime". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]

   "C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp.sln" (default target) (1) ->
   "C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj" (default target) (2) ->
   (CoreCompile target) -> 
     App_Start'BundleConfig.cs(2,18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Controllers'AccountController.cs(8,7): error CS0246: The type or namespace name 'DotNetOpenAuth' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Filters'InitializeSimpleMembershipAttribute.cs(3,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Global.asax.cs(7,18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(4,45): error CS0234: The type or namespace name 'Schema' does not exist in the namespace 'System.ComponentModel.DataAnnotations' (are you missing an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(12,33): error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     App_Start'BundleConfig.cs(9,44): error CS0246: The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(19,16): error CS0246: The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(26,10): error CS0246: The type or namespace name 'DatabaseGeneratedAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(26,10): error CS0246: The type or namespace name 'DatabaseGeneratedAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(22,6): error CS0246: The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
     Models'AccountModels.cs(22,6): error CS0246: The type or namespace name 'TableAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:'Builds'1'SourceCode'MvcApp'Sources'MainLine'Mvc App'MvcApp'MvcApp'MvcApp.csproj]
11 Warning(s)
12 Error(s)

运行时间00:00:06.40

Tfs生成失败

您需要将所有这些dll放在构建机器上。简单的方法是使用NuGet来管理您的包,并将其配置为删除丢失的dll。或者您可以手动将它们添加到构建机器中。

配置Nuget以在构建期间加载依赖项:

http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages

我知道这是一个老问题,但以下是我如何做到这一点的。

我遵循了Daniel Miller的指示:http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages

然后我不得不使用这个链接中提到的简单构建文件http://docs.nuget.org/docs/reference/package-restore-with-team-build这只是预先触发包恢复。

从构建文件中,我所要更改的只是我的解决方案文件和nuget.exe的路径,因为我的不同。

然后,我将TFS配置为使用build.proj文件而不是解决方案。