0

Main idea: i wan't to share some resources (js/css/images) between multiple projects.

I used the possibility Sharing code with Add as Link. meaning, i will have a project which holds all the resources between my multiple web projects.

I thought this idea makes sense and fits great to my problem but it seems like i can not use these resources in my html/aspx view files, it simply doesn't point the correct path, or any path. Once i drag any linked file to my markup, i get a path which is located over the shared project path and is clearly not accessible, i also tried changing the path in few ways but i don't understand how should it work if these files are located in some other project.

  • Did anyone use this option?
  • You can also suggest other ways (though suggestion copy these files in the build step is not a clean option imo)

This image illustrates what i did:

enter image description here

Popokoko
  • 6,413
  • 16
  • 47
  • 58
  • if you aren't copying them into the same directory structure as the rest of the web app, how would you expect the web server which uses the root of the web app as the root of it's directory tree to ever see these items? – Claies Oct 08 '15 at 11:38
  • @Claies what you say makes sense but after all i keep asking myself what's the entire idea of add as a link while the file is not physically inside the project – Popokoko Oct 08 '15 at 11:43
  • Anyway i also tried the same dir structure, it simply doesn't work, wondered if anyone experienced with this issue – Popokoko Oct 08 '15 at 11:48
  • when you say "you also tried the same dir structure", you mean you copied the files from one project to the other and the project still refused to see them? add as link is for source code, not resources. Visual Studio is able to recognize the links when compiling source, but IIS Express can't utilize the links when running as a web server to make available resources not *physically* in the same project directories... – Claies Oct 08 '15 at 20:03
  • I didn't copy the files, that's code duplication in my case. I only used as link. in case this option is not good for my problem, how can i achieve my goal then? – Popokoko Oct 10 '15 at 14:50
  • you'll probably need to create a folder link in the file system, but that usually doesn't play nicely with source control. – Claies Oct 10 '15 at 14:52
  • Also, i read this thread: http://stackoverflow.com/questions/8540292/how-do-you-share-scripts-among-multiple-projects-in-one-solution which wasn't helpful to my problem. – Popokoko Oct 10 '15 at 14:53
  • that question you linked to is essentially the same thing you are trying to do, and it even says the same thing, that the files are not available to the debugger or IIS unless a task is set up to copy them. Bottom line, Add as Link is only useful for **source code**, it is meaningless outside Visual Studio. – Claies Oct 10 '15 at 14:55
  • Hmm I see, okay so before i close this thread, i just wonder one more thing, what about a cdn solution? let's say all the resources on cdn.mydomain and two other domains (app1, app2) would like to access it, but other domains can't, will it work? – Popokoko Oct 10 '15 at 15:22

0 Answers0