0

I have 2 projects ABC and XYZ created as 2 separate Virtual Directories in IIS (7). Now my problem is I have many .JS (script) files in project XYZ that need to be bundled and minfied and rendered in an aspx page (containing HTML code) that is available in project ABC. Is this possible ?

Note: Using Microsoft ASP.NET Web Optimization Framework 1.1.1

[http://www.nuget.org/packages/microsoft.aspnet.web.optimization/]

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Sharma K
  • 107
  • 1
  • 11

1 Answers1

1

Yes, just use the correct link to the bundle in your other project.

If you bundle is for example defines as

 bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

which can get accessed via

 @Scripts.Render("~/bundles/jquery")

you can use

 <script src='http://<host>/<site>/bundles/jquery' type='text/javascript' language='javascript' />

Just as simple as that.

If you have both applications installed on the same website (same root), you can also use relative URLs, e.g.

<script src='/XYZ/bundles/jquery' type='text/javascript' language='javascript' />
MichaC
  • 13,104
  • 2
  • 44
  • 56
  • yep for example. instead of you have to use the website directory of cause. You can also use relative URLs if the site is installed on the same IIS website, then it would be simply /XYZ/bundles/jquery – MichaC Oct 11 '13 at 21:26
  • Yep got it, as you mentioned my website is in the same IIS so using relative URL's fixed it. Thans a lot. – Sharma K Oct 11 '13 at 21:36