如何在nuget中创建像Microsoft.AspNetCore.All这样的元包(所有包
|
New meta package – package of all packages – Microsoft.AspNetCore.All
如何在nuget中为自己的库创建元数据包(所有包的包),如Microsoft.AspNetCore.All? 解决方法
元包是一个引用其他NuGet包的NuGet包,通常不包含任何程序集本身.
如果您创建.nuspec文件,下面是Microsoft.AspNetCore.All NuGet包的.nuspec文件的一部分,然后定义您的依赖项,您可以调用nuget pack YourNuSpecFile.nuspec来创建您的元包. <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Microsoft.AspNetCore.All</id>
<version>2.0.0-preview2-final</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<projectUrl>https://www.asp.net/</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<description>Microsoft.AspNetCore.All</description>
<copyright>Copyright ? Microsoft Corporation</copyright>
<tags>aspnetcore</tags>
<dependencies>
<group targetFramework=".NETCoreApp2.0">
<dependency id="Microsoft.AspNetCore" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Diagnostics" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Hosting" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Routing" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Server.IISIntegration" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Server.Kestrel" version="2.0.0-preview2-final" />
<dependency id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.0.0-preview2-final" />
</group>
</dependencies>
</metadata>
</package>
请注意,上面的一些依赖项已被删除,因为All NuGet包依赖于很多NuGet包. NuGet包依赖项在依赖项部分中定义,您可以选择要依赖的最低版本.另请注意,上面的元包在组内部具有依赖关系,这限制了NuGet包支持的目标框架.下面的另一个例子是Xamarin.GooglePlayServices NuGet包.这里的.nuspec没有为依赖项指定组和目标框架. <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Xamarin.GooglePlayServices</id>
<version>18.0.0</version>
<title>Xamarin Google Play Services Binding (ICS)</title>
<authors>Xamarin Inc.</authors>
<owners>Xamarin Inc.</owners>
<licenseUrl>http://components.xamarin.com/license/googleplayservices</licenseUrl>
<projectUrl>http://components.xamarin.com/view/googleplayservices</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>C# bindings for google play services.</description>
<copyright>Copyright 2013-2014</copyright>
<dependencies>
<dependency id="Xamarin.Android.Support.v4" version="20.0.0" />
<dependency id="Xamarin.Android.Support.v7.MediaRouter" version="20.0.0" />
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="20.0.0" />
</dependencies>
</metadata>
</package>
如果您的NuGet包支持的目标框架不多,那么最好指定组和目标框架.然后,如果不支持该项目,NuGet将不会尝试安装任何依赖项,并且它将在之前产生错误. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows – Html5 Canvas:旋转的文字在Google Chrome上看起
- windows-server-2008-r2 – Windows Server文件共享审核文件
- 使用语义记录Windows Azure配置PartitionKey
- 09、组策略之软件分发(04)
- 页面文件应该与内存量相关的大小(在Windows Server 2008中)
- windows-8 – d3dx11.h不在Windows 8.0套件中
- windows – 如何移动到某些选项卡上某些窗口中存在的非隐藏
- windows-server-2008 – 返回HTTP 503的Microsoft SSTP VPN
- / v / qn参数对windows静默安装程序有什么作用?
- .net – 如何在Windows azure worker角色中创建多个线程
