2016-06-14 13 views
6
Bir Kek komut dosyası kullanarak bir Nuget paketi oluşturmak çalışıyorum

: aşağıdaki hatayı alıyorumKek NuGetPack Yapılandırma

var configuration = Argument("configuration", "Release"); 

var binDir = Directory("./bin") ; 
var nugetPackageDir = Directory("./artifacts"); 

var nugetFilePaths = GetFiles("./**/*.csproj").Concat(GetFiles("./**/*.nuspec")); 

var nuGetPackSettings = new NuGetPackSettings 
{ 
    BasePath = binDir + Directory(configuration), 
    OutputDirectory = nugetPackageDir 
}; 

Task("NuGetPack") 
    .Does(() => NuGetPack(nugetFilePaths, nuGetPackSettings)); 

:

======================================== 
NuGetPack 
======================================== 
Executing task: NuGetPack 
Attempting to build package from 'SomeProject.csproj'. 
MSBuild auto-detection: using msbuild version '12.0' from 'C:\Program Files (x86)\MSBuild\12.0\bin'. 
Unable to find 'C:\DEV\SomeProject\bin\Debug\SomeProject.dll'. Make sure the project has been built. 
An error occured when executing task 'NuGetPack'. 
Error: NuGet: Process returned an error (exit code 1). 

O Debug klasörün yerine de montaj arar Release klasörü. NuGetPack yapı yapılandırmasını nasıl Cake'de yayımlamak için ayarlanır?

cevap

9

Sen nuget pack komuta aşağıdaki komut satırı argümanı -Prop Configuration=Release eklemek gerekir:

var nuGetPackSettings = new NuGetPackSettings 
{ 
    BasePath = binDir + Directory(configuration), 
    OutputDirectory = nugetPackageDir, 
    ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration) 
}; 
4
O Properties özelliği kullanılarak ayarlanabilir

:

var nuGetPackSettings = new NuGetPackSettings 
{ 
    BasePath = binDir + Directory(configuration), 
    OutputDirectory = nugetPackageDir, 
    Properties = new Dictionary<string, string> 
    { 
    { "Configuration", configuration } 
    } 
}; 
İlgili konular