==ASP.NETバンドルでの相対パスを使用==
[[ASP.NET.Core][ASP.NET]]
====App_Start/BundleConfig.cs====
using System.Configuration;
発行時にWeb.configを差し替える設定が必要
*Web.config
<<appSettings>> <<add key="ApplicationContextPath" value=""/>> <</appSettings>>
*Web.Test.config
<<appSettings>> <<add key="ApplicationContextPath" value="/TestApp" xdt:Transform="Replace" xdt:Locator="Match(key)"/>> <</appSettings>>
*Web.Release.config
<<appSettings>> <<add key="ApplicationContextPath" value="/ReleaseApp" xdt:Transform="Replace" xdt:Locator="Match(key)"/>> <</appSettings>>
====_Layout.cshtml====
====実行結果====
*テスト
<<script src="/TestApp/Scripts/jquery-3.3.1.js"><></script>> <<script src="/TestApp/Scripts/bootstrap.js"><></script>>
*本番
<<script src="/ReleaseApp/SalesMsReport/Scripts/jquery-3.3.1.js"><></script>> <<script src="/ReleaseApp/SalesMsReport/Scripts/bootstrap.js"><></script>>