There are many basic frameworks or components in the company, and even for companies that use SOA architecture, there will be a large number of business component contractsProgramSet, which is used by some users for reference management of these frameworks or componentsSource codeManagement tool, but compared with the sourceCodeManagement tools are more convenient:
1) Installation and uninstallation: you do not need to manually add or remove references, or manually rewrite the configuration file or even some code to initialize the service. You only need to execute one command to upgrade the version.
2) Packaging: Multi-file packaging and dependency management are supported. There is no complicated configuration for users.
For the official package, you can find it in the http://www.nuget.org/, you can also submit the package. However, if you do not want to publish the package, you can set up an nuget server internally.
The following describes the basic steps and packaging methods.
1) download nugetserver.rar (including the source code, adapted from mceranski-nugetserver, cannot find the original), compile it, and publish it to the Intranet server. This mvc3 website has several features:
1. Provide nuget services and information about all packages for use by the nuget Package Manager in vs2010
Second, several pages are provided. You can upload packages or browse all packages.
Third, a Web service is provided for the program to automatically upload packages after compilation.
2) download lib.rar (only executable files) and decompress it to the lib directory under the solution directory. This package provides two programs:
The first is the official network nuget.exe tool, which can be called nupkg.
The second is a self-written tool used to upload a package to the nuget Server Web Service. Here is the source code, which will upload the package that is newly compiled.
3) configure the properties of the project to be packaged:
If not "$ (configurationname)" = "release" Exit/B 0
If not exist $ (solutiondir) releasepackages MD $ (solutiondir) releasepackages
$ (Solutiondir) libs \ nuget.exe pack $ (projectdir) $ (projectname). nuspec-o $ (solutiondir) releasepackages \
$ (Solutiondir) libs \ nugetpackageuploader.exe $ (solutiondir) releasepackages \
The script provides the following functions:
Create a releasepackagesfolder and then use nuget.exe to package the package. Then, use nugetpackageuploader.exe to upload the package.
4) Create [project name]. nuspec in the project, package description file:
<? XML version = "1.0" encoding = "UTF-8"?>
<Package>
<Metadata>
<ID> wcfextension </ID>
<Version> 1.0.0.0 </version>
<Title> wcfextension </title>
<Authors> author </authors>
<Projecturl> Project address </projecturl>
<Description> A communication framework based on WCF </description>
</Metadata>
<Files>
<File src = "bin \ release \ *. dll" target = "lib"/>
<File src = "bin \ release \ *. Transform" target = "content"/>
</Files>
</Package>
Here, we break all the DLL into the package, and also put the transform file used to convert the configuration file into the package.
To automatically add nodes to the configuration file, create app. config. Transform and web. config. Transform in the project file and set them:
The file content is the same as that of a common configuration file:
5) After compiling the project with release, you can find that one more package exists in releasepackages, and the package will be uploaded to the remote nuget server.
If the upload is successful, check whether the address in nugetpackageuploader.exe. config is changed to the address of the server deployed for you.
6) after installing the nuget Package Manager plug-in vs2010 on the official website:
Configure the nuget server address to see all the packages Uploaded By yourself:
If your website is deployed to nuget.xxx.com, enter nuget.xxx.com/nuget.
Find the package and click the Install button to install the component.
Open the Package Manager Console and enter get-help nuget. You can see other commands:
----------------------------------------------------------------
Get-Package gets the set of packages available from the package source.
Install-package installa package and its dependencies into the project.
Uninstall-package uninstalla package. If other packages depend on this package,
The command will fail unless the-force option is specified.
Update-package updates a package and its dependencies to a newer version.
New-Package creates a new package when supplied with a nuspec package specification file.
Add-bindingredirect examines all assemblies within the output path for a project and adds binding
redirects to the application (or web) configuration file where necessary.
Get-project returns a reference to the DTE (development tools environment) for the active
or specified project.