在我的CI构建中,我有MSBuild,它将Release版本输出到.\.output\_Build
文件夹中;在这种情况下,此文件夹具有我要打包到nupkg中的exe。
执行时:
NuGet.exe pack -Version "0.1.0" -BasePath ".\.output\_Build" -OutputDirectory ".\.output\Packages\NuGet" ".\src\Project\Project.csproj" -Symbols -verbosity detailed -tool
BasePath
是OutputPath
中的msbuild -OutputPath
文件夹。我明白了:
Attempting to build package from 'Project.csproj'.
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
NuGet.CommandLineException: Unable to find 'c:\project\src\.out\Debug\Project.exe'. Make sure the project has been built.
at NuGet.CommandLine.ProjectFactory.BuildProject()
at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath)
at NuGet.CommandLine.PackCommand.BuildFromProjectFile(String path)
at NuGet.CommandLine.PackCommand.BuildPackage(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
这似乎表明nuget从csproj中读取了Debug配置的OutputDirectory,并且无法找到任何要打包的内容。我认为-BasePath
参数会告诉它在哪里寻找工件,但看起来并非如此。在使用csproj文件进行打包时,如何告诉nuget不遵循csproj中的路径?我必须使用csproj文件包。