Reputation: 5238
I have a build definition in TFS 2015
This build definition is triggered by commits to the master and should build the project, run all the tests and publish Nuget package of projects that contain .nuspec files.
My issue is that i want to pack only projects that contain .nuspec files and not just any project.
I know that i can specify "**\*.nuspec" in the path/pattern, but then i would have to explicitly specify id,title,version,desc,etc... for every nuspec and i want it to be taken from the assembly info.
Is there a way to obtain it?
Arik.
Upvotes: 2
Views: 817
Reputation: 772
You can create a command line task to do it manually :
for /f "delims=" %%a in ('dir /s/b *.nuspec') do nuget pack %%~dpa%%~na.csproj -IncludeReferencedProjects -Properties Configuration=Release
You can also use a minimalist nuspec file (same for each projects that are supposed nugets packages) to take advantage of metadatas from AssemblyInfo :
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>Puresharp</authors>
<owners>Puresharp</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$id$.$version$</description>
<releaseNotes></releaseNotes>
<copyright>$copyright$</copyright>
<tags>Puresharp</tags>
</metadata>
</package>
Upvotes: 0
Reputation: 3776
The .nuspec will not taken the assembly information when generated. We need to modify the id, title, version, etc... manually.
So we just need to pack the .csproj file directly, which will take the assembly information for the generated package.
Upvotes: 1