Nugget: set one project in a solution as unmanaged Nuget?

First of all, let me start by saying that Nuget is amazing. I love it. That being said, there is one thing about it that I just discovered is really really annoying.

We have an internal structure that we use for almost all of our projects. So, I recently created a Visual Studio project template for it, along with VSIX .. had a few problems on the way due to Nuget .. he did not create a new project from the template when the template referred to the framework. since the infrastructure used Nuget, and it could not find the nuget folders in the new project created from the template. Thus, the solution was to remove nuget from the framework project and use only Nuget for other projects (nothing but a framework). Ok, great .. this solves the problem!

However, now with every open Nuget project, it automatically adds these 2 lines to the .csproj framework:

<RestorePackages>true</RestorePackages> 

and

 <Import Project="$(SolutionDir)\.nuget\nuget.targets" /> 

This is disappointing, because now we need to either completely abandon the use of Nuget, or continue to remove these lines from our .csproj file of our framework every time we want to rebuild the template.

Is there a way to show Nuget to ignore one project in a solution? In my case, ignore the draft framework ...

+4
source share
1 answer

With a suggestion from Nailuj, as well as from what I found here: http://samritchie.net/2012/09/17/nuget-packages-in-vs2012-templates/ , I tried something that like me thought it would work, but it did not meet my needs; this method is intended only to include packages in a new project, which for me does not help and does not solve the problem (error regarding missing folders named .nuget). So, I played a little with him and came up with something that is not perfect, but acceptable:

  • Remove anything and what to do with Nuget from the project, which should serve as a template. This leads to a problem with the link structure, since it is expected that the Framework project will be managed by Nuget, and from this solution it is not, so an error occurs ... like this:
  • Remove the framework project from the solution and only reference the DLL so that it builds but does not complain about the absence of nuget folders.
  • Rebuild
  • Export to Template
  • VSIX assembly using the exported template
  • Set pattern
  • Create a new project from a recently installed template
  • Enable Nuget package recovery when solving a new project
  • Open the package manager console
  • Notify about missing packages and agree to download and install them (about 1 minute)
  • Remove the link to the base DLL and replace it with the actual project (right click, add an existing project)
  • Rebuild and run
  • Celebrate!

Hope this helps anyone who might find themselves in this predicament. If anyone has a better idea, please let me know. Generosity is still open for another 6 days, so I will not mark this as an answer.

+1
source

All Articles