0

I have a number of sites that I need to share things with. I have a business core framework library and I can share code with all of my sites using that via nuget. What I need to know is if there is something like this were I can share asp.net pages (aspx) with multiple sites pulled down via a nuget package like my business library is. I want certain pages to be included in all of my sites without having to go and add them each one by one. I would like to just add a nuget package and have them exist in the project. Is this possible?

Barry Franklin
  • 1,781
  • 1
  • 27
  • 45

1 Answers1

0

You can either compile pages into an assembly and distribute it via NuGet. See How do I compile an ASP.NET website into a single DLL file?.

Alternatively you can add those pages as "content" in NuGet and they will get copied into each project. Sample - nuspec contentFiles Example.

You need to decide whether ability to modify files in each project is desired/acceptable - adding files as "content" makes them regular items in a project and hence people can customize them (possibly unintentionally).

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • content in NuGet is complex. If the project using it is a traditional csproj using `packages.config`, then it will copy the files from the `content` directory into the project and can be modified. Projects using `PackageReference` either SDK-style projects or traditional projects, use `contentFiles` from the package, but are not editable by the project using the package. – zivkan May 20 '19 at 19:54