Msbuild Nuget BasePath选项为';未知';

Msbuild Nuget BasePath选项为';未知';,msbuild,visual-studio-2015,nuget,post-build-event,Msbuild,Visual Studio 2015,Nuget,Post Build Event,我正在尝试使用项目文件中的以下代码在C#项目中添加NuGet生成过程作为后构建事件: <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'"> <Message Text="**** Starting after-build process= ****" /> <Exec Command="nuget.exe update -self" /> <

我正在尝试使用项目文件中的以下代码在C#项目中添加NuGet生成过程作为后构建事件:

 <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
    <Message Text="**** Starting after-build process= ****" />
    <Exec Command="nuget.exe update -self" />
    <Copy SourceFiles="$(ProjectDir)bin\release\$(ProjectName).dll" DestinationFolder="$(SolutionDir)Nuget\$(ProjectName)\lib\Net45" />
    <Delete Files="$(SolutionDir)Nuget\*.nupkg" />
    <Exec Command="nuget.exe pack $(ProjectName).nuspec -Properties &quot;Configuration=Release&quot; -BasePath=&quot;$(SolutionDir)Nuget\$(ProjectName)&quot; -OutputDirectory=&quot;$(SolutionDir)Nuget&quot;"  />
    <Message Text="**** After-build process completed ****" />
  </Target>

但我在“生成输出”窗格中收到一条消息:

Unknown option: '-BasePath="<the path shown in here>"
未知选项:'-BasePath=“”
我使用的是NuGet.exe版本3.3.0,我引用的是我的“如何使用”信息


为了查看Visual Studio 2015是否会影响某些事情,我尝试从“生成输出”窗格复制已执行的命令,并插入正确的路径,然后在VS命令提示符下执行该命令。这句话失败了,所以它似乎是个小问题。

< P>我知道它是超迟的,但是问题似乎是你使用<代码> - BasePath=/COD>作为参数,在这里应该说是<代码> - BasePath < /代码>(注意替换你的‘=’字符的空白空间)。 参数不是变量,并且在没有等号的情况下被“赋值”,只要把参数值放在参数名称后面的空白空间后面,像这样:

-BasePath &quot;$(SolutionDir)Nuget\$(ProjectName)&quot;
顺便说一下,如果您试图在(powershell)脚本中使用带有参数的NuGet.exe,也会出现类似的问题。

< p>我知道它是超迟的,但问题似乎是你使用<代码> BasePath=<代码>作为参数,在这里应该说是<代码> - BasePath < /代码>(注意替换你的‘=’字符的空白空间)。 参数不是变量,并且在没有等号的情况下被“赋值”,只要把参数值放在参数名称后面的空白空间后面,像这样:

-BasePath &quot;$(SolutionDir)Nuget\$(ProjectName)&quot;
顺便说一下,如果您试图在(powershell)脚本中使用带有参数的NuGet.exe,也会出现类似的问题。