简体   繁体   English

BrowserLink工具不适用于ASP.NET Core 2.1?

[英]BrowserLink tooling doesn't work with ASP.NET Core 2.1?

Since upgrading to ASP.NET Core 2.1 inside Visual Studio 2017 BrowserLink no longer works. 由于在Visual Studio 2017 BrowserLink中升级到ASP.NET Core 2.1不再有效。 If I use the base "ASP.NET Core Web Application" template, choosing to target ASP.NET Core 2.0 BrowserLink functions perfectly, but if you choose ASP.NET Core 2.1 it doesn't work at all. 如果我使用基本的“ASP.NET核心Web应用程序”模板,选择完美地定位ASP.NET Core 2.0 BrowserLink函数,但如果选择ASP.NET Core 2.1则根本不起作用。

"Enable Browser Link" is ticked and I've tried with/without the Microsoft.VisualStudio.Web.BrowserLink package, upon compiling / launching the web app everything works except browser link. 勾选“启用浏览器链接”,我尝试使用/不使用Microsoft.VisualStudio.Web.BrowserLink包,在编译/启动Web应用程序时,除浏览器链接外,一切正常。 No code is injected into the page and the browser link dashboard remains empty. 没有代码注入页面,浏览器链接仪表板仍为空。

Has anyone managed to get Browser Link working with ASP.NET Core 2.1? 有没有人设法让Browser Link使用ASP.NET Core 2.1?

Turns out it was Visual Studio intellisense being wrong. 事实证明,Visual Studio智能感知是错误的。

I added the Microsoft.VisualStudio.Web.BrowserLink nuget package but visual studio still underlined app.UseBrowserLink() as undefined. 我添加了Microsoft.VisualStudio.Web.BrowserLink nuget包,但visual studio仍然将app.UseBrowserLink()为未定义。 Added using Microsoft.VisualStudio.Web.BrowserLink which VS also underlined as unknown reference, but in fact despite VS underlining it as an error it compiles fine and now BrowserLink works. using Microsoft.VisualStudio.Web.BrowserLink添加了VS,它也强调为未知引用,但实际上尽管VS强调它是一个错误,它编译很好,现在BrowserLink工作。

I had similar problem after upgrading to ASPNET Core 2.1. 升级到ASPNET Core 2.1后,我遇到了类似的问题。 To solve the problem, I have uninstalled the Visual Studio extension I had installed, and then installed the following package via PM: 为了解决这个问题,我已经卸载了我安装的Visual Studio扩展,然后通过PM安装了以下软件包:

Install-Package Microsoft.VisualStudio.Web.BrowserLink -Version 2.2.0

After that, I added the command 之后,我添加了命令

 if (env.IsDevelopment())
      {
        app.UseDeveloperExceptionPage();
        app.UseBrowserLink();
}

and it started working back! 它开始回来了!

Hope this helps! 希望这可以帮助!

if you use Microsoft.AspNetCore.App 2.2.1, you should add Microsoft.VisualStudio.Web.BrowserLink -Version 2.1.1 如果您使用Microsoft.AspNetCore.App 2.2.1,则应添加Microsoft.VisualStudio.Web.BrowserLink -Version 2.1.1


if you use Microsoft.VisualStudio.Web.BrowserLink -Version 2.2.0, you will get error 如果您使用Microsoft.VisualStudio.Web.BrowserLink -Version 2.2.0,您将收到错误

after you setup install nuget package, don't forget rebuild 安装nuget包之后,不要忘记重建

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

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