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