NuGet vs w / EF6 Class Direct Link

I have a class library with numerous EF6 objects. I created NuGet from this library. Whenever I reference the library directly, only the DLL is placed in the trash; however, when I install the library through NuGet, it copies the * Content.tt and * .tt entity files to the folder in the project.

I have a couple of questions around this difference:

  • Why does NuGet require these files if there is no link to the project?

  • Is there a need for these entity files, or can I get NuGet not to clone these files during installation?

My .nuspec file is standard as 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 use to create the package are as follows:

c: \ nuget.exe pack MYID.csproj -IncludeReferencedProjects -Prop Platform = AnyCPU

c: \ nuget.exe add MYID.1.0.0.nupkg -Source M: \ Dev \ NuGetPackages

+8
c # nuget
source share
2 answers

.tt files are not required unless you create a runtime code. Since you are packaging in a dll, it is not. T4 templates (.tt files) are used by the entity framework to generate C # classes from EDMX files, since your objects are modified in the diagram. They will not be required to execute the final code.

Mark the answer. How to exclude the T4 template from the NuGet package , you can exclude .tt files from the package.

+5
source share

A little research on the Internet shows that this problem arose among many users in version 3.4.3 to version 3.4.4 and was addressed in version 3.5.0.

It seems like it was a Microsoft bug between packages. I do not know which version you are using, but I recommend checking this option.

+1
source share

All Articles