I looked at this tutorial for creating a javascript that is used withing several projects in the same solution. Basically, I created a class Library where I have a script folder in which I create a script file which I want to use in several projects within the same solution.
In the script folder of the projects which use the commonscript file, I added an existng item as described in the link above. I added the file as a link and not a copy of the file. However, my view s not able to read this javascript file.
I even add this command to the pre-build event for project using the javascript so I could copy the file from the classlibrary to my project during before building but did did not work either.
copy $(SolutionDir)ClassLibraryName\Scripts\CommonScript.js* $(ProjectDir)Scripts\CommonScript.js
and added the script to my view
<script src="@Url.Content("~/Scripts/CommonScript.js")" type="text/javascript"></script>
How can I create a javascript file and use it in several projects in the same solution