gpt4 book ai didi

nuget - 添加依赖项时 Octopack 构建失败

转载 作者:行者123 更新时间:2023-12-02 22:15:47 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com