简体   繁体   English

NuGet:找不到程序集

[英]NuGet: cannot find Assembly

I have a project that is built using teamcity. 我有一个使用teamcity构建的项目。 Inside teamcity the packages are downloaded using NuGet 在teamcity内部,使用NuGet下载软件包

On our local machines in VS everything works fine, but the Buildserver throws: 在VS中的本地计算机上,一切正常,但是Buildserver抛出:

[13:30:31][ResolveAssemblyReference] Primary reference "System.Web.Http". [13:30:31] [ResolveAssemblyReference]主要参考“ System.Web.Http”。

[13:30:31][ResolveAssemblyReference] C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\Microsoft.Common.CurrentVersion.targets(1635, 5): warning MSB3245: Could not resolve this reference. [13:30:31] [ResolveAssemblyReference] C:\\ Program Files(x86)\\ MSBuild \\ 12.0 \\ bin \\ Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3245:无法解析此引用。 Could not locate the assembly "System.Web.Http". 无法找到程序集“ System.Web.Http”。 Check to make sure the assembly exists on disk. 检查以确保程序集在磁盘上。 If this reference is required by your code, you may get compilation errors. 如果您的代码需要此引用,则可能会出现编译错误。

[13:30:31][ResolveAssemblyReference] For SearchPath "{HintPathFromItem}". [13:30:31] [ResolveAssemblyReference]用于SearchPath“ {HintPathFromItem}”。

[13:30:31][ResolveAssemblyReference] Considered "..\\packages\\Microsoft.AspNet.WebApi.Core.5.0.0\\lib\\net45\\System.Web.Http.dll", but it didn't exist. [13:30:31] [ResolveAssemblyReference]认为“ .. \\ packages \\ Microsoft.AspNet.WebApi.Core.5.0.0 \\ lib \\ net45 \\ System.Web.Http.dll”,但它不存在。

IMHO it should be inside the WebApi.Core which is included inside the packages conf: 恕我直言,它应该在conf包中包含的WebApi.Core中:

<?xml version="1.0" encoding="utf-8"?>

<packages>
  <package id="Autofac" version="3.2.0" targetFramework="net45" />
  <package id="Autofac.Mvc4" version="3.1.0" targetFramework="net45" />
  <package id="FluentValidation" version="5.0.0.1" targetFramework="net45" />
  <package id="libphonenumber-csharp" version="4.10.0.62" targetFramework="net45" />
  <package id="log4net" version="2.0.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.1.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.OData" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Tracing" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" />
  <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
</packages>

There is already a NuGet-Step in TeamCity and it seems to work: TeamCity中已经有一个NuGet步骤,它似乎可以工作:

install] NuGet command: E:\buildAgent1\plugins\nuget-agent\bin\JetBrains.TeamCity.NuGetRunner.exe E:\buildAgent1\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe install E:\buildAgent1\work\78d708595d531418\Common\My.RestConnector\packages.config -OutputDirectory E:\buildAgent1\work\78d708595d531418\Common\packages

[13:30:15][install] Starting: E:\buildAgent1\temp\agentTmp\custom_script3183978839714032953.cmd

[13:30:15][install] in directory: E:\buildAgent1\work\78d708595d531418\Common\My.RestConnector

[13:30:15][install] JetBrains TeamCity NuGet Runner 8.0.27692.9

[13:30:15][install] Registered additional extensions from paths: E:\buildAgent1\plugins\nuget-agent\bin\plugins-2.5

[13:30:15][install] Starting NuGet.exe 2.8.50506.491 from 

    E:\buildAgent1\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe

    [13:30:16][install] Installing 'FluentValidation 5.0.0.1'.

    [13:30:16][install] Installing 'Autofac 3.2.0'.

    [13:30:16][install] Installing 'libphonenumber-csharp 4.10.0.62'.

    [13:30:16][install] Installing 'Autofac.Mvc4 3.1.0'.

    [13:30:16][install] Successfully installed 'Autofac.Mvc4 3.1.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi 5.0.0'.

    [13:30:16][install] Successfully installed 'FluentValidation 5.0.0.1'.

    [13:30:16][install] Successfully installed 'Autofac 3.2.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.Tracing 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.OData 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.Tracing 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.Client 5.1.0'.

    [13:30:16][install] Successfully installed 'libphonenumber-csharp 4.10.0.62'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.OData 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.WebHost 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.WebHost 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.Client 5.1.0'.

    [13:30:17][install] Installing 'Microsoft.Data.OData 5.6.0'.

    [13:30:17][install] Installing 'Newtonsoft.Json 4.5.11'.

    [13:30:17][install] Installing 'Microsoft.Data.Edm 5.6.0'.

    [13:30:17][install] Installing 'System.Spatial 5.6.0'.

    [13:30:17][install] Successfully installed 'Newtonsoft.Json 4.5.11'.

    [13:30:17][install] Successfully installed 'System.Spatial 5.6.0'.

    [13:30:17][install] Successfully installed 'Microsoft.Data.Edm 5.6.0'.

    [13:30:18][install] Successfully installed 'Microsoft.Data.OData 5.6.0'.

    [13:30:18][install] All packages listed in packages.config are already installed.

You didn't download packages on your build server include: 您没有在构建服务器上下载软件包,包括:

nuget restore your.sln 

in your build script (if you're using build script) on your build server. 在构建服务器上的构建脚本中(如果使用的是构建脚本)。

'restore solution mode' is only available in nuget 2.7 “还原解决方案模式”仅在nuget 2.7中可用

But in TeamCity you can select a 'NuGet Installer' step, that will do that for you. 但是,在TeamCity中,您可以选择一个“ NuGet安装程序”步骤,这将为您做到这一点。 Here is an example of configured nuget installer step: http://img.hihi.si/Upload/1tFR.png 这是已配置的nuget安装程序步骤的示例: http ://img.hihi.si/Upload/1tFR.png

Be sure to reorder steps and use this step before build step. 确保重新排序步骤,并在构建步骤之前使用此步骤。

EDIT 1: after you included build log from a build step, i've noticed there is no output for Installing Microsoft.AspNet.WebApi.Core . 编辑1:在包括了构建步骤中的构建日志后,我注意到没有Installing Microsoft.AspNet.WebApi.Core输出。 This could be a number of things, eg projects are not included in solution, packages.config are not included into source control...,something is messed up in the relation with solution/project/packages.config try adding a dummy package into that mvc project and check the output on your build server, if there's no trace of that package in build log the project is being skipped for some reason, if package is included in build log the problem is with that package. 这可能是很多事情,例如,解决方案中不包含项目,解决方案中不包含packages.config ...,与解决方案/project/packages.config的关系有些混乱,请尝试向其中添加虚拟包该mvc项目并检查构建服务器上的输出,如果在构建日志中没有该软件包的踪迹,则由于某种原因该项目被跳过,如果该软件包包含在构建日志中,则问题出在该软件包上。 I'd also try reinstalling this package. 我也尝试重新安装此软件包。

将Microsoft.AspNet.WebApi更新到5.2.2解决了该问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PDFClown nuget软件包无法加载程序集 - PDFClown nuget package cannot load assembly 如何找到包含程序集的nuget包? - How to find the nuget package that contains an assembly? 找不到IObjectWithSite的程序集 - Cannot find assembly for IObjectWithSite MSTest无法找到装配体 - MSTest cannot find the assembly 找不到程序集 - Cannot find assembly 来自 NuGet package 的运行时异常引用类型:'无法加载文件或程序集'Foo'。 该系统找不到指定的文件。' - Runtime exception referencing type from a NuGet package: 'Could not load file or assembly 'Foo'. The system cannot find the file specified.' “‘无法加载文件或程序集‘Elmah’或其依赖项之一。在 NuGet 中使用 Elmah.MVC 后,系统找不到指定的文件” - "'Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified'' after using Elmah.MVC in NuGet '无法加载文件或程序集。 系统找不到指定的文件' - 打包后抛出 .NET 框架 NuGet package - 'Could not load file or assembly. The system cannot find the file specified' - thrown after packaging .NET Framework NuGet package NSB ScriptBuilderTask 无法解析自己的程序集 nuget package - NSB ScriptBuilderTask cannot resolve assembly of own nuget package 在程序集中找不到嵌入式模式 - Cannot find the embedded schemas in the assembly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM