". NET" NuGet release class library package for easy management of DLL files

Source: Internet
Author: User

in large and medium-sized projects there is always a dedicated staff to develop and maintain the underlying class library,encapsulating your own class library can not only improve the reusability of your code,reduce the amount of development,Make your code more concise,can also improve the speed of operation.but,The addition and modification of class library methods causes system developers who use the class library to frequently delete and add references.if the underlyingDLLToo many files,any change will result in a high error rate modification!!for ease of managementDLLfile,we useNuGetHow to update dynamically.

If you are a developer and maintainer of a class library , Please read the published article . If you are a class library-based developer , Please read the article on use .

Publish article:

( Suppose you have developed a class library at this point .)

1. Download the NuGet.exe and place it in the same directory as the . csproj file. This is a good tool for packing. , It can package our engineering documents .

: http://nuget.codeplex.com/downloads/get/669083

2. Register an account on the NuGet website and verify that you have an API Key. we'll call it My_api_key for the time being. .

Registered Address : https://www.nuget.org/  

Then Set API Key.

suggested use to prevent errors start --vs2012--visual Studio tools--vs2012 developer Command Prompt .

Enter the following command settings NuGet API Key: nuget Setapikey <my_api_key>



3. Set the attribute version in your assemblyinfo. cs File , etc., and use it for the first time 1.0.0.0 It . Save settings and compile the entire project .

4.at the command prompt,Enter. csprojdirectory where the files are located,RunNuGetSpecCommand,will generate. Nuspecfile,like I built it here.Itoo. Library.EFBase.nuspec.


5.withNotepad++Open the file,Modify some of these values,It 's useless to erase it..$$between the can without tube,is automatically referencedAssemblyInfo.csthe setting value in.If you're not sure where to change where you need to delete,Let 's do it down.,pending Prompt Warning,can be modified again.

          6. Also at the command prompt , Enter .csproj file directory , Enter the command to generate the class library package , Take my example , command as follows :

Nuget packITOO.Library.EFBase.csproj  . Build after Success . Nupkg file , as I have generated here Itoo. Library.efbase.1.0.0.0.nupkg


7. finally publish the Class library package , enter the command :nuget push Itoo. Library.efbase. 1.0.0.0.nupkg

will prompt for publishing success .




Use the article:

1. Create a new project , right-select Manage NuGet Packages to search for the package name that has been successfully published above c10>, look at me .



Installation Complete , your project has been automatically added to the reference .


Development Articles(continued)

         8. Class library needs to be modified , After the modification is done go to assemblyinfo .cs Modify the version number , Compile save after all modifications are completed

then generate the class library package and publish . that is also the command prompt , Enter . csproj The file directory , run two commands separately :

(1) To generate a class library package , Take my example. :

Nuget packITOO.Library.EFBase.csproj



(2) Publish a class library package , Take my example. :

NuGet Push Itoo. Library.efbase1.0.0. 1.nupkg


Use the article(continued)


2. Right-click on the project to select Manage NuGet Packagesand in the update you will see the class library package we are referencing , click Update .



so far , This little problem is solved. , as development continues to advance , The problem is sure to come back. , we do it and solve it. .



". NET" NuGet release class library package for easy management of DLL files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.