我正在尝试我的第一个 NuGet 包,但遇到了一些麻烦。我有一个相当简单的项目和一个非常简单的 .nuspec 文件:
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<description>$description$</description>
</metadata>
</package>
当我使用此命令行运行 NuGet pack 时:
NuGet.exe pack mylibrary.csproj -Verbosity detailed -Properties Configuration=Debug
我收到此错误:
NuGet.CommandLineException: Unable to find '@(_OutputPathItem->'%(FullPath)mylibrary.dll')'. Make sure the project has been built.
at NuGet.Commands.ProjectFactory.BuildProject()
at NuGet.Commands.ProjectFactory.CreateBuilder(String basePath)
at NuGet.Commands.PackCommand.BuildFromProjectFile(String path)
at NuGet.Commands.PackCommand.BuildPackage(String path)
at NuGet.Commands.PackCommand.ExecuteCommand()
at NuGet.Commands.Command.Execute()
at NuGet.Program.Main(String[] args)
输出文件肯定位于 bin\Debug 文件夹中,但 NuGet 显然找不到它们。
这显然仅在 .csproj 文件的 ToolsVersion 设置为 3.5 或更低时才会发生。将 ToolsVersion 设置为 4.0 可解决该问题。
看来MSBuild 3.5在调用时返回未展开的属性值_project.GetPropertyValue("TargetPath")
(ProjectFactory.cs ~296),其中 MSBuild 4.0 返回扩展的属性值。
我们有同样的问题。添加
-Prop Platform=AnyCPU
命令行使它对我们有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)