I have a class library with numerous EF6 entities. I generated a NuGet from this library. Whenever I reference the library directly only the DLL is placed in the bin, however when I install the library via NuGet it copies over the entities *Content.tt and *.tt files into a folder in the project.
I have a couple of questions around this difference:
Why does the NuGet require these files present when a reference to the project does not?
Is there a need for these entity files or am I able to force the NuGet to not clone these files over when installed?
My .nuspec file is standard like follows:
<?xml version="1.0"?>
<package >
<metadata>
<id>MYID</id>
<version>12.0.2</version>
<title>MYTITLE</title>
<authors>MYNAME</authors>
<owners></owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2017</copyright>
<tags></tags>
</metadata>
</package>
The commands I am using to generate the package are:
c:\nuget.exe pack MYID.csproj -IncludeReferencedProjects -Prop Platform=AnyCPU
c:\nuget.exe add MYID.1.0.0.nupkg -Source M:\Dev\NuGetPackages
.tt files will not be required unless you are doing runtime code generation. Since you are packaging into a dll, this is a not the case. T4 templates (.tt files) are used by entity framework to generate C# classes from EDMX files, as your objects are changed in the diagram. They will not be required to execute the final code.
Check the answer, How to Exclude a T4 Template from a NuGet Package, you can exclude .tt files from packaging.
A little research over the web shows that this issue occurred to a lot of users between 3.4.3 version to 3.4.4 version and was addressed at version 3.5.0.
As it seems, it was a Microsoft bug between the packages. I do not know which version you are using, but I recommend to check this possibility.
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