2

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

Sukhjeevan
  • 3,074
  • 9
  • 46
  • 89
  • 1
    1. Create and publish your class library as a Nuget package. 2. Remove direct references from Website project and Service project to the class library. 3. install the newly created Nuget package in the Website project and Service project. 4. Compile. 5. Deploy. – Zohar Peled Aug 15 '19 at 06:16

3 Answers3

4

Here are some steps you can follow.

  1. 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

  2. Once you have created the nuget package, you can manage the packages in a shared drive location.

  3. 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.

  4. 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

Muthukumar Palaniappan
  • 1,622
  • 5
  • 25
  • 49
0

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

  • While opening NuGet package explorer( https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/tree/master ) I'm getting below error in migration report: PackageExplorer.Package\PackageExplorer.Package.wapproj: The application which this project type is based on was not found Any idea why projects are not loading for me. I'm opening this in VS2015 – Sukhjeevan Aug 18 '19 at 02:39
0
  1. first create nuspec file use nuget spec command from your root directory
  2. create .nupkg from nuspec use nuget pack command from the directory where the nuspec file contains

Note : nuget should install your system, other ways install nuget.exe and copy that to your project root directory

Sarath Baiju
  • 226
  • 2
  • 9