Error Upgrading Blazor from 3.1 to 5.0 "does not have a property matching the name 'PreferExactMatches'"

Viewed 4758

As per the migration document here it recommends to add this property PreferExactMatches

enter image description here

When I do I get this error

InvalidOperationException: Object of type 'Microsoft.AspNetCore.Components.Routing.Router' does not have a property matching the name 'PreferExactMatches'.

Even the API explorer says the property isn't there. Am I missing anything in here? Please suggest. For now I am skipping it and its working.

4 Answers

PreferExactMatches="@true"

@ ! This is a typo by Microsoft.

To anyone deploying to azure web apps, I believe I figured out the issue.

See yannik's post:

The MS migration document was in front of the patch release. (The document is edited in the meantime). The property PreferExactMatches is not yet released, but will be next days.

Now notice that at time of writing (08Jan20) azure still only provides a preview version of .net 5.

screenshot from azure (create web app)

Hence, once azure web apps support the latest .net5 (5.0.1) this issue should be fixed.

Some alternatives:

  • Deploy your web app using the Docker Container option (see img above)
  • Publish a self-contained app.

References:

Related