在后期构建步骤中,我们创建 nuget 包。由于某些原因,这在我的机器上总是失败,而它在其他开发人员机器上工作。
执行的命令是:
nuget.exe pack "$(ProjectPath)" -Properties Configuration=$(ConfigurationName) -OutputDir "$(ProjectDir)..\Apps"
我得到的输出是:
Packing files from ''.
Using 'Organisation.AppName.Modules.Kcs.nuspec' for metadata.
The path is not of a legal form.
对于其他开发人员,第一行包含目录。它在我的盒子上的工作方式不同的原因是什么?我可以设置哪些选项来改变这种行为?
编辑: 我下载了 nuget 源代码,发现事情开始出错了。使用一个小测试程序,我可以模拟它:
using System;
using Microsoft.Build.Evaluation;
namespace CheckTarget
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("usage: CheckTarget projectfile.csproj");
Console.WriteLine();
return;
}
string path = args[0];
var project = new Project(path);
Console.WriteLine("TargetDir = {0}", project.GetProperty("TargetDir") != null ? project.GetProperty("TargetDir").EvaluatedValue : string.Empty);
Console.WriteLine("TargetPath = {0}", project.GetProperty("TargetPath").EvaluatedValue);
Console.ReadKey();
}
}
}
在我的机器上 targetdir 为空,在另一台机器上 targetdir 指向有效目录。