Is there a way to create just ONE NuGet package that will target multiple project types (web forms, MVC, etc.)?

StackOverflow https://stackoverflow.com/questions/18018593

  •  04-06-2022
  •  | 
  •  

سؤال

My company commonly uses Web Forms projects and MVC projects within Visual Studio. When creating a package, the package will/should be different for the different project types.

QUESTION: Rather than creating two slightly different NuGet packages that do exactly the same thing for the two different project types, is there a way to just create ONE NuGet package that's project-type independent? So when installing the package, there will be logic in, perhaps, the .nuspec file that will say "if the project this is being installed on is Web Forms, then do this. If it's MVC, then do this".

I've looked at the following link, for the different ProjectProperties on a project - this seems like something I would utilize, but I'm not sure how.

هل كانت مفيدة؟

المحلول

I would not create a single package for different platforms, because you're loosing flexibility. You might want to take a look at how the Glimpse guys have created their packages as they were facing the same issue.

Check the following packages and the way they are chained:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top