Question

I've started using NuGet to install PostSharp into my projects and this is what I routinely run into:

1) Start new solution and project
2) Add existing project(s) (that new project references) that already use(s) PostSharp
3) Use NuGet to add PostSharp to the new project
4) Try to compile/run but get errors about not being able to load PostSharp properly
5) Realize the new project is using a slightly newer version of PostSharp
6) Use NuGet manager to remove/readd Postsharp to existing projects so they're up to date

Is there a way that I can have NuGet load the same version of PostSharp into new projects that is already being used in the older projects or does NuGet only get the very latest?

Was it helpful?

Solution

The nuget command will specify a specific version if the older versions are available.

EX: Install-Package NUnit -Version 2.6.1

The above example is for NUnit, but I would check to see if the package you're using is available in multiple versions

OTHER TIPS

You actually can install the same version of the NuGet package into the new project that is already being used for the older projects in the solution.

  • Right click on your solution and select "Manage NuGet Packages for Solution".
  • Look at the "Installed packages" and click on the package you're interested in (PostSharp in your case)
  • Then click the "Manage" button and add check-boxes on all projects where you want this package to be installed

I find that managing packages on a solution level is a better way, otherwise it's easy to run into problems with many different versions of the same packages throughout the solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top