标签:
STEP 1:在NuGet上注册并获取API Key使用以下命令设置NuGet API Key:nuget setApiKey <my_api_key>,记得把my_api_key替换为 SETP 1中获得的API Key。
SETP 4:开发类库并更改程序集配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [assembly: AssemblyTitle( "AC.Core" )] [assembly: AssemblyDescription( "wychuan‘s .net core lib." )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "wychuan" )] [assembly: AssemblyProduct( "AC.Core" )] [assembly: AssemblyCopyright( "Copyright ? wychuan 2015" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] [assembly: ComVisible( false )] [assembly: Guid( "fac8fea2-2803-4382-b145-ed5f660bdc58" )] [assembly: AssemblyVersion( "1.0.0.0" )] |
1 | nuget spec |
用editplus打开AC.Core.nuspec文件,把需要替换的信息替换掉,不需要的tag全部删掉,注意里面的$xxx$宏,这些就是引用了AssemblyInfo.cs中的设置值,在编译产生package的时候,会使用AssemblyInfo.cs中的相应值进行替换。完成编辑后,我们的nuspec文件如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?xml version="1.0"?> <package > <metadata> <id>$id$</id> <version>$version$</version> <title>$title$</title> <authors>$author$</authors> <owners>$author$</owners> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl> <projectUrl>http://www.wychuan.com</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>$description$</description> <releaseNotes>my first init release.</releaseNotes> <copyright>Copyright 2015</copyright> </metadata> </package> |
另外,NuGet会使用默认的项目配置所产生的程序集进行打包。如果项目默认是Debug,而你需要用Release打包,则使用下面的命令:
1 | nuget pack AC.Core.csproj -Prop Configuration=Release |
1 | nuget pack AC.Core.csproj -Prop Configuration=Release -IncludeReferencedProjects |
1 | nuget push AC.Core.1.0.0.0.nupkg |
标签:
原文地址:http://www.cnblogs.com/wych/p/4380315.html