我需要使用stylecop.json和something.ruleset创建一个nuget包,并引用stylecop分析器。该软件包将在所有团队中使用,以标准化.net规则。我读过这篇:
但是很遗憾,我没有正确理解如何实现这一目标。我有stylecop.json和.ruleset文件。我已完成以下步骤:
[请让我知道现在要创建包括stylecop.json和.ruleset文件的nuget包需要做什么?
请让我知道现在要创建nuget包需要做什么。包括stylecop.json和.ruleset文件?
您应该在xxx.nuspec
中添加有关这些文件的一些节点,然后将nuget.exe cli与xxxx.nuspec文件一起使用来打包您的项目。
自]以来,您已经生成了xxxx.nuspec
文件,应将它们添加到nuspec文件中。
解决方案>>
[1)您应该将这些节点添加到xxx.nuspec
文件中,并通过nuget将这些文件添加到新项目中。
<?xml version="1.0" encoding="utf-8"?> <package > <metadata> ....... <contentFiles> <files include="any/any/stylecop.json "(the relativepath of the file under the ContentFiles folder in the xxx.nupkg) buildAction="None" copyToOutput="true" flatten="false" /> <files include="any/any/xxxx.Ruleset "(the relativepath of the file under the ContentFiles folder in the xxx.nupkg) buildAction="None" copyToOutput="true" flatten="false" /> </contentFiles> </metadata> <files> <file src="stylecop.json(the relativePath of the file under the project)" target="contentFiles/any/any" /> <file src="xxxx.Ruleset(the relativePath of the file under the project)" target="contentFiles/any/any" /> <file src="stylecop.json(the relativePath of the file under the project)" target="content" /> <file src="xxxx.Ruleset(the relativePath of the file under the project)" target="content" /> </files> </package>
[2)
然后可以在CMD中使用nuget pack
打包项目,然后将获得xxx.nupkg
,它是nuget程序包。