根据发布位置确定javascript/css域
我在Visual Studio 2013中创建了一个解决方案,其中包括两个web应用程序项目根据发布位置确定javascript/css域,javascript,html,visual-studio,Javascript,Html,Visual Studio,我在Visual Studio 2013中创建了一个解决方案,其中包括两个web应用程序项目Core.web和App.webCore.Web使用urlWeb.Core.devApp.Web使用urlWeb.App.dev Core.Web包含几个可以在项目之间共享的javascript和css文件App.Web引用这些javascript文件App.Web可能有一个html文件,如 <!DOCTYPE html> <html xmlns="http://www.w3.org/1
Core.web
和App.web
Core.Web
使用urlWeb.Core.dev
App.Web
使用urlWeb.App.dev
Core.Web
包含几个可以在项目之间共享的javascript和css文件App.Web
引用这些javascript文件App.Web
可能有一个html文件,如
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>App1.Web</title>
<!-- core javascript -->
<script src="//web.core.dev/Javascript/Common.js" type="text/javascript"></script>
<script src="//web.core.dev/Javascript/Ticker.js" type="text/javascript"></script>
<!-- local javascript -->
<script src="index.js" type="text/javascript"></script>
<!-- core css -->
<link href="//web.core.dev/Style/Reset.css" rel="stylesheet" type="text/css" />
<link href="//web.core.dev/Style/Global.css" rel="stylesheet" type="text/css" />
<!-- local css -->
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
...
</body>
</html>
App1.Web
...
这在当地很管用。但当我开始发布live时,除非我手动更改这些链接(web.core.dev
更改为core.mywebsite.com
)。我希望能够发布该项目,而不必担心将本地HREF更改为实时HREF
是否有一个标准策略允许根据域的发布位置更改域?一种适用于
.aspx
和.html
文件的策略?您可以使用web.config中的AppSettings并将配置文件转换为您的构建配置文件。@TryingToImprove这对aspx页面有效,但您能否建议如何适用于普通html文件?这不仅是.NET应用程序的常见问题,因此必须有一个标准的解决方案?