nuget - 添加依赖项时 Octopack 无法构建

标签 nuget nuget-package octopus-deploy

Octopack 无法使用以下 xml 进行构建

<?xml version="1.0"?>
<package >
  <metadata>
    <id>WebCrawlerMVC</id>
    <version>1.0.0.0</version>
    <title>Web Crawler</title>
    <authors>lardern</authors>
    <owners>Nostrum Group</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>packaging webcrawler mvc</description>
    <releaseNotes>no release notes</releaseNotes>
    <copyright>Copyright 2013</copyright>
  </metadata>
   <dependencies>
        <dependency id="Ninject" version="3.0.1.10" />
        <dependency id="HtmlAgilityPackHelpers" />
    </dependencies>
    <files src="C:\Users\lardern\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll"/>
    <files src="C:\Users\lardern\Documents\Visual Studio 2010\Projects\HtmlAgilityPack\HtmlAgilityPack\HtmlAgilityPackHelpers\bin\Release\HtmlAgilityPackHelpers.dll" />
</package>

我收到的错误是

Error 2 The command ""C:\Users\lardern\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC..\packages\OctoPack.1.0.111\tools\NuGet.exe" pack "C:\Users\lardern\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC\WebCrawlerMVC.nuspec" -OutputDirectory "bin" -basePath "C:\Users\lardern\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC" -Version "1.0.0.0" -NoPackageAnalysis" exited with code 1. WebCrawlerMVC

我不太确定这意味着什么,如果我没有添加依赖项,它会在版本中正常构建,否则会返回此错误。

编辑:我编辑了上面的代码,感谢 adam 发现错误,但错误仍然发生。 还取出每个依赖项以查看是否有一个导致错误,两次都失败。

最佳答案

如果您查看完整的构建日志,您应该能够找到比上面的错误行更多的信息 - NuGet.exe 可能正在提示它们。

不过八达通套餐should not include dependencies anyway .

Another NuGet feature that doesn't translate well to Octopus is dependencies. NuGet has a convenient feature for tracking dependencies between packages. This is used when, for example, a package like NHibernate depends on a package like log4net. NuGet will install NHibernate, resolve the dependency, and install log4net. It's important to note that NuGet will install them to two separate folders on disk:

packages/NHibernate.x.y.z
packages/log4net.x.y.z

While this makes sense for libraries referenced via Visual Studio, it doesn't make sense in Octopus, for the same reasons as above. For example, if your Octopus application package had a dependency on log4net, on disk you would have:

packages/YourApp.x.y.z  
packages/log4net.x.y.z

At runtime, the executables or ASP.NET site under YourApp would try to invoke a method in log4net, and fail because the DLL can't be found. While this could theoretically be solved using probing paths in your configuration file, in practice it's better to avoid this approach.

For this reason, Octopus NuGet packages cannot have dependencies.

Instead, any libraries you need to use should be bundled inside of your package in the standard binaries folder

关于nuget - 添加依赖项时 Octopack 无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14499733/

相关文章:

visual-studio - 启动解决方案时如何禁用恢复NuGet软件包

c# - 如何在我的新 CSPROJ 类库中包含带有 native dll 的 NuGet 包?

azure - Microsoft.Azure.Management.Resourcemanager.Fluent 和 Microsoft.Azure.Management.Fluent nuget 包之间有什么区别?

visual-studio-2017 - 启用 PackageReference 时 Nuget 在哪里下载包

visual-studio - Visual Studio 2013/2015 包管理器控制台未初始化

.net - Dotnet Nuget/package 文件夹非常大并且对于每个用户

c# - Nuget 包更新 - Microsoft.Data.SqlClient.SNI.x64

ssl - 使用 Octopus 在 iis 上为每个站点部署单独的证书

continuous-integration - Octopus 和持续集成-应该在何时创建发行版的最佳实践是什么?

使用调用运算符并传递自定义凭据的 Powershell 启动过程