最近,我开始收拾的NuGet包了我的几个项目。首先,我开始与包资源管理器应用程序。这是一个很好的工具,但如果你这样做持续集成它的用处不大。然后我看着指定的 nuspec 的模板文件,并通过不断变化的数据,例如:版本号,作为命令行参数。后来,我不知道如何定义的NuGet软件包的依赖关系。事实证明,在nuget.exe已经这样做的基础上的 package.config 的,如果你指定的的csproj 的。此外,它提取如作者,版本,版权由集信息权的相关数据。我很想念现在是指定在命令行licenseUrl的能力。但我想这个问题是比较通用的。于是我问:
Recently, I started to pack nuget packages out of my several projects. First I started with the Package Explorer application. It is a nice tool, but it's less useful if you do continuous integration. Then I looked into specifying the nuspec template file, and passing changing data, e.g. version number, as command line arguments. Later, I wondered how to define the nuget package dependencies. As it turns out, the nuget.exe already does this based on the package.config if you specify a csproj. Moreover, it extracts relevant data like Author, Version, Copyright right from the assembly info. What I'm missing right now is the ability to specify a licenseUrl in the command line. But I wanted the question to be more generic. And so I'm asking:
什么是prefered的方式来包装的NuGet包?
推荐答案
下面是一个鲜为人知的事实:您可以结合这两种! 目标一的csproj文件,并确保有与相同的名称的csproj文件的同一目录中的nuspec文件。的NuGet将包创建过程中合并这两个。
Here's a little-known fact: you can combine both! Target a csproj file, and make sure there's a nuspec file in the same directory with the same name as the csproj file. NuGet will merge the two during package creation.
因此,在短期:目标<项目名>的.csproj
,选择添加相应的的标记化 的<项目名> .nuspec
文件中使用由NuGet.exe元数据。
So in short: target <ProjectName>.csproj
, optionally add a corresponding tokenized <ProjectName>.nuspec
file to be used as metadata by NuGet.exe.
这样可以节省你从管理输出位置,依赖关系,版本,和其他的东西,可以从项目中得到的。
It saves you from managing output location, dependencies, version, and other stuff that can be derived from the project.
相关推荐
最新文章