简体   繁体   English

ASP.NET重建javascript文件

[英]ASP.NET rebuilding javascript files

Debugging my asp.net webpage requires a simple save. 调试我的asp.net网页需要一个简单的保存。 From there I can just refresh my page to view my changes to the webpage. 从那里我可以刷新我的页面以查看我对网页的更改。 However Ive noticed that javascript scripts outside of the aspx file don't update. 但是我注意到aspx文件之外的javascript脚本不会更新。 When I refresh my browser the javascript files don't update when I save changes to them. 当我刷新浏览器时,当我保存对它们的更改时,javascript文件不会更新。 So my question is how do I get the compiler to rebuild my javascripts and deploy them? 所以我的问题是如何让编译器重建我的javascripts并进行部署? Im using visual studio 2010. Is there some setting to make this automatically happen if not how do I get VS to compile or deploy these javascripts to the browser? 我正在使用visual studio 2010.是否有一些设置可以自动实现,如果不是如何让VS编译或部署这些javascripts到浏览器? Build website/ Build solution / Rebuild don't work by the way neither does running debug. 构建网站/构建解决方案/重建不会按照运行调试的方式工作。

To add the file im using: 要使用以下方法添加文件:

<script language="javascript" type="text/javascript"  src="../UserControls/JavaScript/Comment.js"></script>

if that helps. 如果这有帮助。

JavaScript does not need to be compiled by VS2010 for ASP.NET. JavaScript不需要由VS2010 for ASP.NET编译。 It is compiled locally on the browser. 它在浏览器上本地编译。

If it's caching, for IE10 (which I assume you are using with VS2010), hit F12 (Developer Tools). 如果是缓存,对于IE10(我假设您使用的是VS2010),请点击F12(开发人员工具)。 The second icon from the left shows a window with a red X, which clears the cache for development. 左边的第二个图标显示了一个带有红色X的窗口,该窗口清除了用于开发的缓存。 Click that, wait for the cache to completely clear, close IE10, and get back in. In some cases, you may need to restart IIS or clear the development server from the system tray. 单击它,等待缓存完全清除,关闭IE10,然后重新进入。在某些情况下,您可能需要重新启动IIS或从系统托盘中清除开发服务器。

Otherwise, be sure you're saving the correct JavaScript files. 否则,请确保保存正确的JavaScript文件。 If you're deploying it to a remote server, be sure the JavaScript files are deployed, and then the browser cache cleared. 如果要将其部署到远程服务器,请确保已部署JavaScript文件,然后清除浏览器缓存。

This worked for me: 这对我有用:

Goto IE(I am using IE11) In that Settings->Interenet options->General Tab->Browsing history ->Setting change it to Every time i visit the webpage. 转到IE(我正在使用IE11)在那个设置 - >互联网选项 - >常规选项卡 - >浏览历史 - >设置更改为每次我访问网页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM