Use script files from another project inside same solution

2.9k Views Asked by At

I'm trying to use some script files between different projects. I have one solution with four projects. In the project "A" I have some scripts like Jquery, Javascript Plugins, etc, and i want to use them on the project "B", by adding a scriptmanager, or anything that works. What can i do this?

I'm using Visual Studio 2010.

Here is a printscreen with my environment.

enter image description here

[EDIT]

Hello, after doing what @CStick says, a have now the scripts in my other project, so a can't add them to a ScriptManager. The problem is path not found on Asp.net code. It cant find the script cause they're placed in the other project. What can i do to solve it?

1

There are 1 best solutions below

0
On

I know this is old, but for future reader i post an answer.

You will have to use "Link project file" for this.

  1. From the target project, right click on the folder you what the file to be
  2. Select add -> Existing file
  3. Browse to the file you need then click on the arrow at the right of the add button and select add as a link

After this you can modify the file in booth project, but the fille will be only in the source physical location until you publish the project. This can cause problem for client side file, like script file, on debug because you cant view the file because it's not physically in the target project. You can use MsBuild to copy the source file on the target directory on build. (See this answer)

In short, you will create a .targets file then add a reference in your project file.