arnaudleclerc / AzureMapsControl.Components

Razor Components for azure-maps-control
MIT License
34 stars 12 forks source link

Error: Microsoft.JSInterop.JSException: Could not find 'azureMapsControl.Core.addMap' ('azureMapsControl' was undefined). #58

Closed ADefWebserver closed 2 years ago

ADefWebserver commented 2 years ago

When I try to run I get Error: Microsoft.JSInterop.JSException: Could not find 'azureMapsControl.Core.addMap' ('azureMapsControl' was undefined).

To Reproduce Steps to reproduce the behavior: 1) Open the AzureMapsControl.Sample project in Visual Studio 2022 and put in Key in appsettings,json like this:

{ "AzureMaps": { "SubscriptionKey": "{{my Key}}" },

2) Add the AzureMapsControl.Components so it builds 3) Run it

image

ADefWebserver commented 2 years ago

It does work if I only run the AzureMapsControl.Sample project in Visual Studio 2022 (using "Start Without Debugging" because "Start Debugging" only opens a blank web page) and add the Nuget package to it.

arnaudleclerc commented 2 years ago

You need to transpile the typescript code to create the .js files, which is not done via the build of the projects. For that, under /src/AzureMapsControl.Components, simply run npm run build.

Let me know if this worked!

ADefWebserver commented 2 years ago

Thank you for the explanation on how to compile the source code. Since simply adding the NuGet package has it working I am good to go. The reason I don't want to use the NPM method is I have several Angular projects that have not been upgraded and I can't upgrade my NPM (sigh)