加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

使用Asp.Net 5进行实时重新加载

发布时间:2020-12-16 00:17:07 所属栏目:asp.Net 来源:网络整理
导读:在Asp.Net 5中,开发速度更快,因为它在保存时编译. 但我仍然需要手动刷新浏览器. Visual Studio中是否有实时重新加载选项,还是应该使用gulp插件? 解决方法 您可以启用BrowserLink并在编辑代码时按Ctrl Alt Enter以使浏览器自动刷新.或者,您可以点击Visual St
在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中添加Browser Link NuGet包:

"dependencies": {
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",// Omitted...
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读