I'm creating a NuGet package the provides a client for my WebAPI project by reflecting over the ApiControllers and creating classes for each one with methods that correspond to the actions defined on the controller. Unfortunately the .tt file is being included in the content folder when I run nuget.exe pack Client.csproj. I've tried creating a .nuspec file with a <files> directive, but I can't seem to exclude the file by itself. Does anyone know how to force the package to exclude the T4 template?
The project structure is roughly:
Website/
Controllers/
UserController.cs
...
Client/
Client.tt
Client.cs
namespace Client
class UserService
...
And I'd like a NuGet package like:
lib/
net45/
Client.dll
namespace Client
class UserService
But I'm getting something like this:
content/
Client.tt
lib/
net45/
Client.dll
namespace Client
class UserService
...
NuGet.exe Pack Client.csproj -Exclude **/*.tt
In my case the problem was inside csproj file, I had to fix
<Content Include="SomeFile.txt" />
to
<None Include="SomeFile.txt" />
Turns out the easy solution is to use the -Exclude option when creating the package via the command line.
NuGet.exe Pack Client.csproj -Exclude *.tt
The new package will look exactly as specified in the question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With