I am running into an issue where I am deploying a Blazor app that contains several public NuGet packages into a Linux Docker container. The container builds properly and adds the appropriate dll files of the packages into /app
and /scr
, but it isn't putting the js files into the wwwroot
folder.
I can reproduce this with a minimal app by:
<script type="text/javascript" src="_content/BlazorInputMask/Main.js"></script>
<script type="text/javascript" src="_content/BlazorInputMask/IMask.js"></script>
404 - Main.js
not foundThis works properly when doing a non-containerized build. It's just the container that is the problem.
The problem exists with the scaffolded Dockerfile generated by VS.
I tried laying out a Nuget.config
file with the following code, but I got the same behavior:
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="wcmMapsSrc" value="." />
</packageSources>
Well, I found the problem!
There is a case mismatch between the NuGet package's docs and code base. In the docs, they reference Main.js
but the filename is main.js
.
This never presented a problem in any non-Dockerized deployment we have run, all of which have been Windows-based. However, when run through the Linux container there must be some case-sensitivity added.
Updating my codebase to reference the proper script file name solved the issue.
<script type="text/javascript" src="_content/BlazorInputMask/main.js"></script>
Turns out, not a NuGet concern. Leaving this here for others.