在 Asp.Net 5 中,开发速度更快,因为它在保存时进行编译。 但我还是得手动刷新浏览器。
Visual Studio 中是否有实时重新加载选项,或者我应该使用 gulp 插件吗?
最佳答案
您可以启用 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 中添加浏览器链接 NuGet 包:
"dependencies": {
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",
// Omitted...
}
关于asp.net - 使用 Asp.Net 5 实时重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33034169/