user5830202
user5830202

Reputation:

Blazor Server build error - new web application causes build errors

I recently installed Blazor as part of my Visual Studio Community 2019 version 16.3.2 installation. After creating a brand new Blazor Server web application in VS 2019 I have tried to run the app, only to get 3 errors in the build. The errors are:

  1. Error: Project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.targets\ImportAfter\Microsoft.Web.ImportAfter.targets" was not imported by "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets" at (6101,3), due to the file being invalid. OktaBlazorAspNetCoreServerSide C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.targets\ImportAfter\Microsoft.Web.ImportAfter.targets
  2. Error: Project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\Managed.Web\Microsoft.Web.Designtime.targets" was not imported by "C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\targets\Microsoft.NET.Sdk.Web.ProjectSystem.targets" at (42,5), due to the file being invalid. OktaBlazorAspNetCoreServerSide C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\Managed.Web\Microsoft.Web.Designtime.targets
  3. Error MSB4024 The imported project file "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.targets\ImportAfter\Microsoft.Web.ImportAfter.targets" could not be loaded. Root element is missing. OktaBlazorAspNetCoreServerSide C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets

I haven't encountered MSBuild errors like this before and I need some directions. I am using .Net Core 3.0.100. If I use dotnet run from the command line the project runs as expected.

Upvotes: 2

Views: 1082

Answers (2)

user5830202
user5830202

Reputation:

Updating Visual Studio Community 2019 to version 16.3.3 seems to have fixed this problem. I can create a new Blazor Server application and build and run with no errors, using DotNET Core SDK 3.0.100 on Windows 10. I guess the update must have contained the necessary bugfixes to finally try out this new product.

Upvotes: 2

nkahootzShawn
nkahootzShawn

Reputation: 165

I had some odd issues with Blazor applications with Visual Studio 2019. I had been running the preview versions of Visual Studio 2019 and installed the release version on top of that. Completely uninstalling VS2019 and reinstalling fixed everything for me. Not a great solution, but it did resolve the weirdness I was having.

Upvotes: 1

Related Questions