Reputation: 3156
We have below in .sln file.
1.Website project
2.Service project
2.Framework ClassLibrary project
We want to create a NuGet package of this ClassLibrary project which will be used in any other project. As of now website & service project contains direct reference to CL project so 1st step is to decouple CL project from website & service project but if we do we'll get compile time error while building website project. Does that means we have to change whole code in CL project before decouple.
After successful decouple , we'll remove this CL project from solution and will reference like NuGet package.
NuGet package can be created as explained in this link Create NuGet package
Upvotes: 2
Views: 15110
Reputation: 294
Note : nuget should install your system, other ways install nuget.exe and copy that to your project root directory
Upvotes: 0
Reputation: 1
1) Create class library 2) Set target framework to .NET Standard 1.4 from property > Library tab
Fro more help go to this link https://learn.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2015
Upvotes: 0
Reputation: 1670
Here are some steps you can follow.
Please follow this link to create a nuget pacakge for the Class library. https://learn.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-visual-studio
Once you have created the nuget package, you can manage the packages in a shared drive location.
In your visual studio, go to tools -> nuget package manager -> Package manager settings -> Package source. Where you can provide the shared drive url. so that your visual studio can probe in the location for any nuget package.
Remove the existing dll reference in your 2 projects. Right click on your web/services project and click manage nuget package. you will be listed with your newly created pacakge, which you can choose and add.
There wouldn't be any code change required
Upvotes: 4