MatBlazor icon indicating copy to clipboard operation
MatBlazor copied to clipboard

Install docs missing how to get js includes @ https://www.matblazor.com/

Open Astn opened this issue 6 years ago • 7 comments

Following the guide from https://www.matblazor.com/ Install section / Static files does not say how to get the matBlazor.js file.

Static files

For client-side and server-side Blazor - add script section to index.html or _Host.cshtml (head section)

<script src="_content/MatBlazor/dist/matBlazor.js"></script>

Where does this file come from?

Astn avatar Dec 30 '19 20:12 Astn

This file is part of the NuGet package and will be included as part of the built output.

You do not need to manually add that file.

agc93 avatar Dec 31 '19 04:12 agc93

This file is part of the NuGet package and will be included as part of the built output.

You do not need to manually add that file.

where is that stated? OP is simply pointing out the default steps to add BlazorComponents as per official Microsoft Docs

Mercurial avatar Dec 31 '19 10:12 Mercurial

There must be something tricky about the way I'm hosting my blazor app, as I was getting 404 when I initially tried to include.

I ended up finding the file here on github and copying it manually into my project.

I'm hosting using "Areas" and the path to my blazor app is essentially. http://localhost/Area/tools/blazorapp

Would this have something to do with that include file not being available? Also how would I manually verify that this matBlazor.js file is being built in the output?

Astn avatar Dec 31 '19 18:12 Astn

where is that stated? OP is simply pointing out the default steps to add BlazorComponents as per official Microsoft Docs

I interpreted as coming from the MatBlazor docs rather than the MS docs, possibly my mistake there.


I haven't used it with Areas so I suspect this is being affected by the changes in how RCL static assets are referenced.

agc93 avatar Jan 01 '20 07:01 agc93

I know this one has been open for a long time, but I was encountering the same exact problem where the matBlazor.js and matBlazor.css files always returned 404s. The issue didn't exist in a newly built blazor app, just in an existing app in which I was integrating new blazor components. In my case, I narrowed down the problem to the IWebHostBuilder.UseStartup call in Program.cs...

In my case we don't use use the simple builder.UseStartup<Startup>() overload since we have multiple startup classes for different environments (e.g. StartupDevopment, StartupProduction, etc.). When we made the call, we were doing the following, where StartupBase is a subclass for our other startup classes:

builder.UseStartup(typeof(StartupBase).Assembly.FullName);

When changing it to the following, the 404 errors we were getting for the matBlazor.js and matBlazor.css files just went away:

builder.UseStartup(typeof(StartupBase).Assembly.GetName().Name);

I have no clue why this fixes it, but hopefully this helps someone else out there.

kylepope-ge avatar Jun 17 '20 19:06 kylepope-ge

I have the same issue.

The way it's triggered here is when i add ASPNETCORE_ENVIRONMENT to environmentVariables in launchSettings.json.

If this property is not set to something of my liking, it works fine. When I set it to something of my preference, it gets a 404.

I kinda need to use these profiles since I have different customer in different profiles (different configurations). Is there any way around this?

No 404:

    "Docker-Staging": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "environmentVariables": {
        "CustomerSetup": "Staging"
      },
      "publishAllPorts": true,
      "useSSL": true
    },

404:

    "Docker-Production": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "environmentVariables": {
        "CustomerSetup": "Production",
        "ASPNETCORE_ENVIRONMENT": "Production"
      },
      "publishAllPorts": true,
      "useSSL": true
    }

Kla3mus avatar Jun 02 '21 11:06 Kla3mus

I had a similar issue but for me it wasn't working using "Local" but was for "Development". Any news on why this is the case?

Allann avatar Feb 24 '23 03:02 Allann