我正在尝试我的第一个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>
Run Code Online (Sandbox Code Playgroud)
当我使用此命令行运行NuGet包时:
NuGet.exe pack mylibrary.csproj -Verbosity detailed -Properties Configuration=Debug
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
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)
Run Code Online (Sandbox Code Playgroud)
输出文件肯定在bin\Debug文件夹中,但NuGet显然没有找到它们.
这显然只有在.csproj文件的ToolsVersion设置为3.5或更低时才会发生.将ToolsVersion设置为4.0可以解决问题.
似乎MSBuild 3.5在调用_project.GetPropertyValue("TargetPath")(ProjectFactory.cs~296)时返回未展开的属性值,其中MSBuild 4.0返回展开的属性值.
lle*_*lco 57
我们遇到了同样的问题.加入
-Prop Platform=AnyCPU
Run Code Online (Sandbox Code Playgroud)
到命令行使它对我们有用.
这显然仅在 .csproj 文件的 ToolsVersion 设置为 3.5 或更低时才会发生。将 ToolsVersion 设置为 4.0 可解决该问题。
我在这里为 NuGet 项目团队创建了一个问题:https ://nuget.codeplex.com/workitem/4012
| 归档时间: |
|
| 查看次数: |
9299 次 |
| 最近记录: |