foreword
[PS: The original text is hand-typed, reprinted to explain the source, blog garden ]
Java has Maven, .net has Nuget, the concepts are not elaborated one by one, and Baidu is my own. Go straight to the topic below
Build Nuget Server
crime tool
Tools: vs2017, Nuget.exe
Nuget server version: Nuget 3.1.2 (the highest version at the time of writing)
Steps to build Nuget server
- 1: Open VS2017 and create a new Asp.Net Web empty application (.net framework4.6)
- 2: Select Tools -> Nuget Package Manager -> Package Manager Console
- 3: Enter Install-Package NuGet.Server
- 4: Modify the Value value of ApiKey in Web.config and fill it in arbitrarily (if you need to change the key value when using Nuget Package Explorer or nuget pull command, the author does not need to be so troublesome, so I will not explain)
- 5: Right-click to publish the website and publish to IIS (successful installation)
Packaging dynamic libraries
The general summary process is
- Generate spec file
- Generate nupkg file using spec file
- upload nupkg file
- Using VS Nuget
Generate Package.nuspec , the command is as follows
nuget spec
The generated directory is prefixed with the console folder
Edit the Package.nuspec file
<?xml version="1.0"?> <package > <metadata> <id>package name (dynamic library name)</id> <version>version number</version> <authors>作者</authors> <owners>Owners (just fill in the author)</owners> <licenseUrl>licenseUrl</licenseUrl> <projectUrl>projectUrl</projectUrl> <iconUrl>iconUrl</iconUrl> <requireLicenseAcceptance>Require license acceptance (default false)</requireLicenseAcceptance> <description>描述</description> Feel like <releaseNotes> doesn't work? </releaseNotes> <copyright>Copyright 2018</copyright> <tags>标签</tags> <dependencies> dependencies <dependency id="SampleDependency" version="1.0" /> </dependencies> </metadata> </package>
lift chestnuts
The contents of Package.nuspec are as follows ( PS: When the dynamic library has dependencies, the dependencies node is required, otherwise it is not required. When the dynamic library has no dependencies on .netframework, the group node can be removed to retain the inner node )
<?xml version="1.0"?> <package > <metadata> <id>MK.Tool</id> <version>4.2.111.7</version> <authors>zhoudemo</authors> <owners>zhangsan</owners> <licenseUrl>http://license.zhoudemo.com</licenseUrl> <projectUrl>http://product.zhoudemo.com</projectUrl> <iconUrl>http://icon.zhoudemo.com</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>This is a description 17777</description> <releaseNotes>This is a description 2</releaseNotes> <copyright>Copyright 2018</copyright> <tags>MK Tool TEST</tags> <dependencies> <group targetFramework=".NETFramework4.5"> <dependency id="Newtonsoft.Json" version="9.0.1" /> </group> </dependencies> </metadata> </package>
Generate nupkg file
Copy the MK.Tool.4.2.111.7.nupkg file to the Server Packages directory, NugetServer will automatically monitor and decompress it automatically, so the above-mentioned uploading with tools and uploading with commands will not be described.
end, attached.
The last dry goods, the source code address used in this article: click me to download , don't blame me, because the blog garden does not allow uploading more than 10 megabytes, so turn 1 point, hehe.