【发布时间】:2016-01-07 03:51:10
【问题描述】:
在 Asp.Net 5 中,开发速度更快,因为它在保存时编译。 但是我还是要手动刷新浏览器。
Visual Studio 中是否有实时重新加载选项,或者我应该为此使用 gulp 插件吗?
【问题讨论】:
标签: asp.net visual-studio-2015 asp.net-core asp.net-core-mvc livereload
在 Asp.Net 5 中,开发速度更快,因为它在保存时编译。 但是我还是要手动刷新浏览器。
Visual Studio 中是否有实时重新加载选项,或者我应该为此使用 gulp 插件吗?
【问题讨论】:
标签: asp.net visual-studio-2015 asp.net-core asp.net-core-mvc livereload
您可以启用 BrowserLink 并在编辑代码时按 Ctrl+Alt+Enter 以使浏览器自动刷新。或者,您可以点击 Visual Studio 工具栏中的浏览器链接刷新按钮。
public void Configure(IApplicationBuilder application)
{
// Only enable browser link if IHostingEnvironment says it's
// running in Development.
if (this.hostingEnvironment.IsDevelopment())
{
// Allow updates to your files in Visual Studio to be shown in
// the browser. You can use the Refresh
// browser link button in the Visual Studio toolbar or Ctrl+Alt+Enter
// to refresh the browser.
application.UseBrowserLink();
}
// Omitted...
}
您还需要在 project.json 中添加 Browser Link NuGet 包:
"dependencies": {
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",
// Omitted...
}
【讨论】:
context => Mats 做了一个新的扩展,在 SAVE 按钮后会自动刷新。从 Visual Studio 库中抓取 VS 扩展。
保存您的 VS 更改并重新加载浏览器。
https://visualstudiogallery.msdn.microsoft.com/46eef4d9-045b-4596-bd7f-eee980bb5450
【讨论】: