NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 250 forks source link

TT files included when excluded in nuspec files, but excluded when using -exclude #5617

Open ch53k opened 6 years ago

ch53k commented 6 years ago

NuGet product used: Nuget.exe CLI and VSTS Nuget Task NuGet version: 4.1.0.2450

I have a project I'm trying to pack up, I generate a bunch of CS files using TT templates for database model definitions. These generated CS files get compiled into the final DLL so the TT files are not needed in the Nuget package. The project structure is simple with a single folder "Database" that contains some TT files and their corresponding CS files. But when I try to exclude the TT files using the files tag in in my nuspec file those files are always included, but if I excluding them with the -exlcude command they are excluded. I've included a sample project, along with the commands and output.

My nuspec files is defined as follows: `<?xml version="1.0"?>

$id$ $version$ $title$ $author$ $author$ false $description$ Initial Release. Copyright 2017 ModelExample ` I then us the following command to execute the packing: `nuget pack model.csproj -outputDirectory c:\source\nugetTest -Properties Configuration=Release -version 17.0.19 -Verbosity Detailed` The Result I get is (stripped out some company information): Id: Model Version: 17.0.19 Authors: Model Company Description: Model Tags: ModelExample Dependencies: Added file '[Content_Types].xml'. Added file '_rels/.rels'. Added file 'content/Database/DbContext.tt'. Added file 'lib/net452/Model.dll'. Added file 'Model.nuspec'. Added file 'package/services/metadata/core-properties/fd1a17da31024345ad237a1647ea0f57.psmdcp'. Successfully created package 'c:\source\nugetTest\Model.17.0.19.nupkg'. But when I run the following command: `nuget pack model.csproj -outputDirectory c:\source\nugetTest -Properties Configuration=Release -version 17.0.19 -Verbosity Detailed **-exclude **/database/*.*` The Result I get is: Id: Model Version: 17.0.19 Authors: Model Company Description: Model Tags: ModelExample Dependencies: Added file '[Content_Types].xml'. Added file '_rels/.rels'. Added file 'lib/net452/Model.dll'. Added file 'Model.nuspec'. Added file 'package/services/metadata/core-properties/b662a1ed847642d2807436f2d6a5a8a1.psmdcp'. Successfully created package 'c:\source\nugetTest\Model.17.0.19.nupkg'. My sample project for this ticket. [Model.zip](https://github.com/NuGet/Home/files/1159876/Model.zip)
emgarten commented 6 years ago

nuget pack model.csproj -outputDirectory c:\source\nugetTest -Properties Configuration=Release -version 17.0.19 -Verbosity Detailed **-exclude **/database/*.*

Is there a reason for the ** before -exclude?

ch53k commented 6 years ago

No, I was trying to bold that section of the command to accentuate the difference. Unfortunatly because of the other *s it wouldn't. I thought I had removed all of the extra **, I must of missed those 2.

nuget pack model.csproj -outputDirectory c:\source\nugetTest -Properties Configuration=Release -version 17.0.19 -Verbosity Detailed -exclude **/database/*.*