问题描述
我正在为公司创建一个私有的NuGet包,我想分发.dll
的两个不同版本.版本.dll
适用于一些可以调用此dll进行开发的开发人员.还有一些开发人员的debug .dll
id,用于为第二个版本开发dll本身.
I'm creating a private NuGet package for my company and I want to distribute two different versions of my .dll
. The release .dll
was for some developers who can call this dll for development. And the debug .dll
id for some developers to develop the dll itself for the second version.
所以我的问题是,如果我只想通过使用一个 NuGet包来完成此任务,这可能吗?我是否必须在软件包的安装过程中创建一个脚本,以便在MSBuild中添加引用,还是使事情变得过于复杂?
So my question is that if I wanted to accomplish this by using only one NuGet package, is this possible? Do I have to create a script on the installation of the package that adds references in the MSBuild, or am I overcomplicating things?
有什么建议吗?预先感谢.
Any suggestion? Thanks in advance.
推荐答案
据我所知,您可能使这件事变得过于复杂.这意味着您要使用一个dll
进行调试模式进行测试,而使用另一个dll
进行发布模式进行开发,因此这两个dll文件应该是独立的,应将其分发到不同的程序包中.因为NuGet包通常只包含用于特定目标框架的一组程序集.它并不是为发布调试和发布版本而设计的.
To my knowledge, you may overcomplicating this things. That means you want to use one dll
for debug mode to test and another dll
for release mode to develop, so those two dll files should be independent, which should be distributed to different packages. Because a NuGet package will normally hold just a single set of assemblies for a particular target framework. It is not really designed to ship a debug and release version.
此外,当我们发布nuget程序包时,dll
的发行版是最佳选择,因为用户不会调试您的dll
,他们只会关心它是否可以正常工作以及如何工作.
Besides, when we publish nuget package, the release version of your dll
is the best choice since users wont debug into your dll
, they will only care about if it works fine and how it works.
此外,NuGet支持使用任何字符串作为后缀来表示预发行版本,因为NuGet会将任何此类版本视为预发行版本,并且不做任何其他解释.因此,您可以使用-beta
指定该dll的新版本进行开发.
In addition, NuGet supports use any string as a suffix to denote a pre-release version, as NuGet treats any such version as pre-release and makes no other interpretation. So you can use -beta
to specify a new version of that dll for develop.
https://docs.microsoft .com/en-us/nuget/reference/package-versioning#pre-release-versions
就我的理解而言,基本上,使用其他版本的软件包应该更好.当然,如果您坚持使用一个软件包,Nekeniehl提供了正确的指导.
Basically per my understanding, use a different version of the package should be better. Of course, if you persist on using one package, Nekeniehl provided the correct direction.
希望这对您有所帮助.
这篇关于具有配置框架的自定义nuget包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!