我有以下带有此代码的FAKE文件,用于将NuGet包打包在一个解决方案中:https://github.com/Aaronontheweb/akka-monitoring/blob/master/build.fsx#L143
for nuspec in !! "src/**/*.nuspec" do
printfn "Creating nuget packages for %s" nuspec
CleanDir workingDir
let project = Path.GetFileNameWithoutExtension nuspec
let projectDir = Path.GetDirectoryName nuspec
let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head
let releaseDir = projectDir @@ @"bin\Release"
let packages = projectDir @@ "packages.config"
let packageDependencies = if (fileExists packages) then (getDependencies packages) else []
let dependencies = packageDependencies @ getAkkaDependency project
let releaseVersion = release.NugetVersion
let desc = description project
let pack outputDir =
NuGetHelper.NuGet
(fun p ->
{ p with
Description = desc
Authors = authors
Copyright = copyright
Project = project
Properties = ["Configuration", "Release"]
ReleaseNotes = release.Notes |> String.concat "\n"
Version = releaseVersion
Tags = tags |> String.concat " "
OutputPath = outputDir
WorkingDir = workingDir
Dependencies = dependencies })
nuspec
// Copy dll, pdb and xml to libdir = workingDir/lib/net45/
ensureDirectory libDir
!! (releaseDir @@ project + ".dll")
++ (releaseDir @@ project + ".pdb")
++ (releaseDir @@ project + ".xml")
++ (releaseDir @@ project + ".ExternalAnnotations.xml")
|> CopyFiles libDir
// Copy all src-files (.cs and .fs files) to workingDir/src
let nugetSrcDir = workingDir @@ @"src/"
// CreateDir nugetSrcDir
let isCs = hasExt ".cs"
let isFs = hasExt ".fs"
let isAssemblyInfo f = (filename f).Contains("AssemblyInfo")
let isSrc f = (isCs f || isFs f) && not (isAssemblyInfo f)
CopyDir nugetSrcDir projectDir isSrc
//Remove workingDir/src/obj and workingDir/src/bin
removeDir (nugetSrcDir @@ "obj")
removeDir (nugetSrcDir @@ "bin")
// Create both normal nuget package and symbols nuget package.
// Uses the files we copied to workingDir and outputs to nugetdir
printfn "nugetDir %s" nugetDir
pack nugetDir
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>@project@</id>
<title>@project@@title@</title>
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<licenseUrl>https://github.com/Aaronontheweb/akka-monitoring/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Aaronontheweb/akka-monitoring</projectUrl>
<iconUrl>https://raw.githubusercontent.com/akkadotnet/akka.net/gh-pages/images/icon-32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>@description@</description>
<releaseNotes>@releaseNotes@</releaseNotes>
<copyright>@copyright@</copyright>
<tags>@tags@</tags>
@dependencies@
</metadata>
</package>
自从升级到最新版本的FAKE和NuGet后,我收到以下错误:
Time Elapsed 00:00:01.03
Finished Target: Build
Starting Target: CopyOutput (==> Build)
Creating D:\Repositories\olympus\akkadotnet-performance-counters\bin\Akka.Monitoring
Creating D:\Repositories\olympus\akkadotnet-performance-counters\bin\Akka.Monitoring.StatsD
Finished Target: CopyOutput
Starting Target: CleanNuget
Creating D:\Repositories\olympus\akkadotnet-performance-counters\bin\nuget
Finished Target: CleanNuget
Starting Target: BuildRelease (==> CopyOutput, CleanNuget)
Finished Target: BuildRelease
Starting Target: Nuget (==> BuildRelease)
Creating nuget packages for D:\Repositories\olympus\akkadotnet-performance-counters\src\Akka.Monitoring\Akka.Monitoring.
Nuspec
Creating D:\Repositories\olympus\akkadotnet-performance-counters\bin\build
Creating D:\Repositories\olympus\akkadotnet-performance-counters\bin\build\src\
Deleting D:\Repositories\olympus\akkadotnet-performance-counters\bin\build\src\obj
D:\Repositories\olympus\akkadotnet-performance-counters\bin\build\src\bin does not exist.
nugetDir bin\nuget
D:\Repositories\olympus\akkadotnet-performance-counters\.nuget\nuget.exe pack -Symbols -Version 0.3.3 -OutputDirectory "
D:\Repositories\olympus\akkadotnet-performance-counters\bin\nuget" "D:\Repositories\olympus\akkadotnet-performance-count
ers\src\Akka.Monitoring\Akka.Monitoring.Nuspec" -Properties Configuration="Release"
Running build failed.
Error:
System.Exception: Error during NuGet package creation. D:\Repositories\olympus\akkadotnet-performance-counters\.nuget\nu
get.exe pack -Symbols -Version 0.3.3 -OutputDirectory "D:\Repositories\olympus\akkadotnet-performance-counters\bin\nuget
" "D:\Repositories\olympus\akkadotnet-performance-counters\src\Akka.Monitoring\Akka.Monitoring.Nuspec" -Properties Co
nfiguration="Release"
The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' cannot contain text. Lis
t of possible elements expected: 'references, summary, frameworkAssemblies, developmentDependency, language, dependencie
s' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.
at Fake.NuGetHelper.NuGet(FSharpFunc`2 setParams, String nuspecOrProjectFile) in C:\code\fake\src\app\FakeLib\NuGet\N
ugetHelper.fs:line 406
at FSI_0001.Build.createNugetPackages[a](a _arg1) in D:\Repositories\olympus\akkadotnet-performance-counters\build.fs
x:line 185
at FSI_0001.Build.clo@228-8.Invoke(Unit _arg1) in D:\Repositories\olympus\akkadotnet-performance-counters\build.fsx:l
ine 229
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 41
1
TL; DR;似乎FAKE实际上不再在.nuspec文件上进行占位符替换,而NuGet正在获取文件的文字内容,而不是使用提供的编程值的合并文件。
我做错了什么?
答案 0 :(得分:1)
菲克正在寻找&#34; .nuspec&#34;文件,但您的文件名为&#34; .Nuspec&#34;。 https://github.com/fsharp/FAKE/commit/15dc617624ac514268b8e9a4bd80dd1203e61054应该修复它。正在发布。
下次您可能想要打开一个FAKE问题。然后我会更快地修复它。