我正在寻找为 MSBuild C# api 编写一个包装器。我的构建工作正常,但出于某种奇怪的原因,即使我传入参数,我也很难让 Nuget 包恢复运行。
我在作为NETWORK SERVICE运行的服务中运行它
The command ""..\.nuget\nuget.exe" install "C:\BuildTemp\application1\packages.config" -source "" -RequireConsent -o "..\packages"" exited with code 1.
我是否正确传递了它们?
var pc = new ProjectCollection();
var buildProperties = new Dictionary<string, string>
{
{"Configuration", "Release"},
{"Platform", "Any CPU"},
{"OutputPath", _outputPath},
{"EnableNuGetPackageRestore", "true"}
};
var buildParameters = new BuildParameters(pc);
var buildRequest = new BuildRequestData("C:\myapplication.csproj",
buildProperties,
null,
new[] { "Clean", "Rebuild" },
null);
更新:这似乎适用于某些环境而不是其他环境。为什么会这样?