【问题标题】:The command "nuget pack..." exited with code 1命令“nuget pack ...”以代码 1 退出
【发布时间】:2017-03-04 04:58:01
【问题描述】:

我正在尝试执行基于 .nuspec 文件构建 nuget 包的构建后事件。我正在使用 Visual Studio 2013。我的后期构建事件命令行是:

nuget pack $(ProjectPath) -Symbols -Properties Configuration=$(ConfigurationName) -IncludeReferencedProjects

当我构建我的项目时,我收到以下错误:

The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\
BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug 
-IncludeReferencedProjects" exited with code 1.

我不确定发生了什么 - 我将 Visual Studio 构建输出更改为诊断并发现:

>Using 'BookProject.nuspec' for metadata. (TaskId:44)
>Access to the path 'C:\BookProject.1.0.3.4.nupkg' is denied. (TaskId:44)
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\  BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug -IncludeReferencedProjects" exited with code 1.
>Done executing task "Exec" -- FAILED. (TaskId:44)
>Done building target "PostBuildEvent" in project "Miw.Mshdf.Net.Nuget.csproj" -- FAILED.: (TargetId:72)

如果我打开命令提示符并输入构建后事件命令,它可以正常工作并且构建 nuget 包没有任何问题。有什么想法吗?

【问题讨论】:

    标签: asp.net visual-studio visual-studio-2013 nuget nuget-package


    【解决方案1】:

    根据错误码,你的问题应该是路径“C:\”的访问权限有关。请以管理员身份运行您的 Visual Studio,以确保它有足够的权限来执行任何操作。

    并确保您当前的 Windows 用户也有足够的权限来访问“C:\”。

    【讨论】:

      【解决方案2】:

      我使用的解决方法是

       1. Right click on solution -> manage nuget package for solution
       2. On top there is text "install missing packages" -> click restore
       3. Also i manually given the package sources in -tools ->Nuget package manager -> 
       package sources
       4. run VS 2013 in administrator mode and gave permission to the required folders
      

      【讨论】:

        猜你喜欢
        • 2018-01-22
        • 2017-11-30
        • 2018-05-03
        • 1970-01-01
        • 1970-01-01
        • 2013-08-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多