문제

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/]

도움이 되었습니까?

해결책

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' />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top