2

I have two projects and both are in Asp.Net MVC4. One project is legacy application and another is new one. I have some style-sheets and scripts in legacy project which I want to use in new project. I don't want to copy those files in new project but want to have a reference of those files. How it can be achieved.

I tried with this approach but when I typed URL of my css in browser, I got page not found error.

Community
  • 1
  • 1
Ankush Jain
  • 3,773
  • 3
  • 21
  • 42

1 Answers1

4

Add as link doesn't work for this. There's only two ways to share static resources between projects:

  1. Create a Nuget package that includes the common files. Then install the Nuget in each project that needs these files. Each project will literally get a copy of the files, so you're not truly sharing the file, but it does give you a common source and a way to easily update the files in each project based on that.

  2. Host the static resources as a separate website, and then link to them in your HTML code via the URL of that website. This way the actual file will not actually be in your project but the project can still utilize it.

Chris Pratt
  • 207,690
  • 31
  • 326
  • 382