0
我们目前在多个项目中使用一些共享的T4文件。这些文件现在存在于各种git存储库中,因此我们想通过nuget分发它们。nuget:无参考地部署T4文件
使用这些文件创建一个nuget包作为内容工作正常,但然后我在每个项目中获得这些T4的单独副本。不幸的是,我们每个存储库仍然有很高的项目数量,因此我们会得到重复的文件。这会减慢克隆和结账操作。
我试着找到类似于Nunit3TestAdapter的方法:只需将文件部署到nuget包的libs文件夹中,但不要更改项目中的任何内容。
这样我们可以只有这些共享文件的一个副本。
如何在nuspec文件中管理这个?只要我没有要添加到项目中的文件,我就会收到消息“您正尝试将此软件包安装到以'.NETFramework,Version = v4.0'为目标的项目中,但该软件包不包含任何程序集引用或与该框架兼容的内容文件。有关更多信息,请联系软件包作者。“
这是我目前的nuspec文件(当我们建立通过TFS包中的$变量替换):
<?xml version="1.0"?>
<package>
<metadata>
<id>$SolutionName$</id>
<version>$Version$</version>
<authors>$SSH$</authors>
<owners>$SSH$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Softship common T4 templates. Current Version: $Version$</description>
<copyright>Copyright $date$</copyright>
<!-- Do not list this as dependency of other nuget -->
<developmentDependency>true</developmentDependency>
</metadata>
<files>
<file src="build/net35/MultipleOutputHelper.ttinclude" target="build\net35" />
<file src="build/net35/GenerateTextMessages.ttinclude" target="build\net35" />
<file src="build/net35/DataModelRelationsGenerator.ttinclude" target="build\net35" />
<file src="build/net35/DataModelGenerator.ttinclude" target="build\net35" />
</files>
</package>
什么版本的NuGet的是你使用?我怀疑如果NuGet没有考虑足够的build文件夹以允许安装继续,那么你可能不得不放置一个虚拟的'lib/net35 /_._'占位符来允许它安装。各种.NET Core NuGet包使用这种技术 - 不提供程序集,但它允许将NuGet程序包安装到项目中。示例是System.Xml.Document。 '_._'只是一个空文件。 –
我想,' \t \t \t <文件SRC = “工具/ MultipleOutputHelper.ttinclude” 目标= “工具”/> \t \t \t <文件SRC = “工具/ GenerateTextMessages.ttinclude” 目标= “工具”/> \t \t \t <文件SRC = “工具/ DataModelRelationsGenerator.ttinclude” 目标= “工具”/> \t \t \t <文件SRC = “工具/ DataModelGenerator.ttinclude” 目标= “工具”/> \t \t \t \t '它工作精细。 –