0

We have a website that pulls data from a separate web-services site via AJAX. (MVC 5 for the former, WebAPI for the latter.)

We have some javascript classes defined to make interfacing with these web-services simpler. These classes need to be loaded in the pages of the website, but I'd really prefer that they actually live in the web-services site project.

Not only are they conceptually linked to the web services that they wrap, I also need to include them in a separate web-service-unit test project.

I'd thought that I'd be able to put the files in the web-services project, and then to include them in the website project and the unittest project, as links. (Add Existing Item -> Add as Link)

The problem is that this doesn't work. When I do a script include of the linked file, the browser can't see it. In actual fact, the file isn't there, there's just a notification in the .csproj file pointing to where it really is, and the web server doesn't understand that.

So, what should I do, instead? I'm sure others have had the problem.

1
  • It is. Vote to close. Commented Jun 4, 2014 at 19:47

1 Answer 1

0

I think that problem could be related to following facts:

  • JavaScript file it's not copied inside script folder of destination website
  • IIS express point as basedir at destination website root folder and use script folder where the file it's not copied

You can inspect this problem trying to display source code of page and click on external JavaScript file; you should get a 404 error page where display the wrong path.

If you try to deploy the application, the external linked JavaScript file should be deployed correctly inside script folder.

For solve this problem that should affect development environment you could create a custom post build script that take care of copy and replace file to destination folder script.

Hope this helps

Maurizio

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.