TeamCity构建项目编译错误

时间:2013-06-27 13:40:20

标签: continuous-integration teamcity nuget

我正在尝试让TeamCity构建一个我创建的简单Web项目。该项目是使用Visual Studio 2012模板为网站创建的。我还没有添加任何东西。

该项目将在本地计算机上构建并运行良好,当我使用Visual Studio(sln)运行程序时,它将无法构建。

我一直收到以下错误......(对于长剪切和粘贴道歉)

[MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "AspNet.ScriptManager.jQuery.UI.Combined". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, 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:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth.Consumer". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId.RelyingParty". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.AspNet". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNet.Membership.OpenAuth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNet.FriendlyUrls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output] 

[14:22:40][MSBuild output] 

[14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest.sln.teamcity" (TeamCity_Generated_Build target) (1) ->

[14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest.sln" (Rebuild target) (2) ->

[14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj" (Rebuild target) (3) ->

[14:22:40][MSBuild output] (CoreCompile target) -> 

[14:22:40][MSBuild output]   App_Start\AuthConfig.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   Account\Manage.aspx.cs(7,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   Account\OpenAuthProviders.ascx.cs(4,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   Account\Register.aspx.cs(8,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   Account\RegisterExternalLogin.aspx.cs(4,7): error CS0246: The type or namespace name 'DotNetOpenAuth' could not be found (are you missing a using directive or an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   Account\RegisterExternalLogin.aspx.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   App_Start\RouteConfig.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output]   ViewSwitcher.ascx.cs(8,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]

[14:22:40][MSBuild output] 

[14:22:40][MSBuild output]     11 Warning(s)

[14:22:40][MSBuild output]     8 Error(s)

[14:22:40][MSBuild output] 

[14:22:40][MSBuild output] Time Elapsed 00:00:00.56

这些引用似乎都是NuGet Refs,我在TeamCity中错过了一步吗?我应该使用不同的跑步者吗?

4 个答案:

答案 0 :(得分:15)

TeamCity正在寻找它们的位置可能不存在。当解决方案/依赖关系被移动时,我已经看到了这一点。

您可以尝试在文本编辑器中打开.csproj文件,并查看相关程序集的<HintPath>值。这些通常是相对路径,因此您需要确保它们与CI服务器上的目录结构对齐。理想情况下,目录结构将在两种环境中匹配。

示例:

<ItemGroup>
    <Reference Include="ServiceStack">
        <HintPath>..\packages\ServiceStack.3.9.56\lib\net35\ServiceStack.dll</HintPath>
    </Reference>
    ...
</ItemGroup>

您可能还想在下一次构建之前检查“在构建之前清理结帐目录中的所有文件”框,以确保它获取更改。

答案 1 :(得分:4)

我最近有这个。

对我来说,有两件事有助于解决问题。

1)我将嵌套的解决方案文件夹中的项目移动到根级别。 2)我检查了TeamCity服务器上的工作文件夹,看看SVN检查了什么(在我的情况下)以及正在下载/恢复的软件包。我不得不删除/添加丢失的软件包和其中一个软件包(Microsoft.OWIN.Hosting),这根本没有下载/恢复(我不认为它可以在Nuget上找到软件包)所以我有删除包,在我的项目中显式引用DLL,并将DLL复制到相同位置的TC框。真的很可怕,但得到了建设。我确信有更好的方法可以做到这一点 - 可能是SVN中的Externals。

希望这有帮助。

答案 2 :(得分:2)

我认为你刚刚在你的构建中遗漏了你的nuget包,因为它可能会在一个新的位置。那是除非你让他们签入源代码管理?你需要告诉teamcity来获取它们。

有一个Teamcity Nuget安装构建步骤,用于获取包Teamcity nuget installer docs,或者您可以执行自己的任务来执行此操作。

答案 3 :(得分:0)

仅仅是为了记录,这可能是因为您的解决方案中存在依赖关系......

e.g。如果在结账时文件夹被“清理”并且您的构建依赖项是错误的,那么dll将不会在任何地方。

我在TeamCity未能应用修补程序后遇到此问题,并且项目未设置为在结帐时自行清理...当未清除时,构建依赖性问题不明显。

由于错误导致正在清理的文件夹...因此构建依赖性问题出现在前台。