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

非 Y 不嫁゛ 提交于 2019-12-04 18:27:18

问题


Since upgrading to ASP.NET Core 2.1 inside Visual Studio 2017 BrowserLink no longer works. 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.

"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. 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?


回答1:


Turns out it was Visual Studio intellisense being wrong.

I added the Microsoft.VisualStudio.Web.BrowserLink nuget package but visual studio still underlined app.UseBrowserLink() as undefined. 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.




回答2:


I had similar problem after upgrading to 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:

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!




回答3:


if you use Microsoft.AspNetCore.App 2.2.1, you should add Microsoft.VisualStudio.Web.BrowserLink -Version 2.1.1


if you use Microsoft.VisualStudio.Web.BrowserLink -Version 2.2.0, you will get error

after you setup install nuget package, don't forget rebuild



来源:https://stackoverflow.com/questions/52207185/browserlink-tooling-doesnt-work-with-asp-net-core-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!