Open Xorcist77 opened 1 year ago
I have presently worked around this issue/limitation by running a BASH script as my build command (i.e. ./netlify.build.sh) which I have marked as executable in Git via using:
git update-index --chmod=+x netlify.build.sh
Internally the script downloads and installs .NET 7.0 using Microsoft's publicly available .NET Script Installer for Linux, and then publishes the Blazor WASM project as such:
#!/usr/bin/env bash
set -e
## install latest .NET 7.0 release
pushd /tmp
wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod u+x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --channel 7.0
popd
## publish project to known location for subsequent deployment by Netlify
dotnet publish -c Release -o release
I do still feel the build image should be updated yearly to include the most recent release of .NET, so that Blazor WASM projects can be built without having to resort to these types of work-arounds. But for anyone that needs a more immediate resolution, the above method should suffice.
waiting for the automated build for .net7. please can someone. help? how to use the above workaround in netlify?
Step 1 - Modify the site's Netlify Build Settings to run a script as your build command (using my own as an example)
Step 2 - Create the BASH script file to be run
(I placed mine in the Blazor WASM client project folder, which is also the Netlify base directory)
/src/code/Client/netlify.build.sh
Step 3 - Edit the BASH script as necessary (using my own as an example) (obviously make any necessary changes based on your own project structure)
#!/usr/bin/env bash
set -e
## install latest .NET 7.0 release
pushd /tmp
wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod u+x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --channel 7.0
popd
## publish project to known location for subsequent deployment by Netlify
dotnet publish -c Release -o release
Step 4 - Ensure the script file is marked as executable in the Git repository
git update-index --chmod=+x netlify.build.sh
Step 5 - Commit, Push, Pull Request etc. to get Netlify to trigger a build
Hopefully that detailed outline will be more useful for people.
Thank you very much. this helped me very much. now my build is using .net7 SDK
Step 1 - Modify the site's Netlify Build Settings to run a script as your build command (using my own as an example)
Step 2 - Create the BASH script file to be run (I placed mine in the Blazor WASM client project folder, which is also the Netlify base directory)
/src/code/Client/netlify.build.sh
Step 3 - Edit the BASH script as necessary (using my own as an example) (obviously make any necessary changes based on your own project structure)
#!/usr/bin/env bash set -e ## install latest .NET 7.0 release pushd /tmp wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh chmod u+x /tmp/dotnet-install.sh /tmp/dotnet-install.sh --channel 7.0 popd ## publish project to known location for subsequent deployment by Netlify dotnet publish -c Release -o release
Step 4 - Ensure the script file is marked as executable in the Git repository
git update-index --chmod=+x netlify.build.sh
Step 5 - Commit, Push, Pull Request etc. to get Netlify to trigger a build
Hopefully that detailed outline will be more useful for people.
Ideally image should have SDKs for multiple versions and then we could control which version to use by global.json file.
https://learn.microsoft.com/en-us/dotnet/core/tools/global-json
The solutions to fetch and install adds build time...
Please make some noise in this issue to: https://github.com/netlify/build-image/issues/742
Seems like documentation is completely missing dotnet.
Is your feature request related to a problem? Please describe.
Presently unable to build .NET 7 projects with the current build image (though .NET 6 projects build fine). There is a specific need for the .NET 7 build support, so that latest features available to Blazor WASM can be taken advantage of (this will most likely be the same case for future .NET revisions, which are released yearly).
Describe the solution you'd like
Please include the .NET 7 SDKs as part of the build image (they were released to the general public on 2022-11-08). It would be great to see the yearly releases of .NET regularly added to the build image in a timely fashion so they can be used "out of the box" so to say.
Describe alternatives you've considered
Considerations have been made to utilize a bash script to auto-install the required .NET release and build accordingly, but this requires an extra CI/CD specific file to be source controlled as part of the project (and feels more like a work-around for something that should already be supported). Blazor WASM has enough industry adoption to warrant .NET 7's inclusion in the build image (as well as regular inclusion of subsequent future .NET revisions).
Additional context
Can you submit a pull request?
No