Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Add Support for .NET 7 #877

Open
Xorcist77 opened this issue Nov 21, 2022 · 6 comments
Open

Add Support for .NET 7 #877

Xorcist77 opened this issue Nov 21, 2022 · 6 comments
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@Xorcist77
Copy link

Xorcist77 commented Nov 21, 2022

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

Netlify_NET7

Can you submit a pull request?

No

@Xorcist77 Xorcist77 added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Nov 21, 2022
@System-Crash
Copy link

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.

@TheDevTwister
Copy link

waiting for the automated build for .net7. please can someone. help?
how to use the above workaround in netlify?

@System-Crash
Copy link

Step 1 - Modify the site's Netlify Build Settings to run a script as your build command (using my own as an example)
Build Settings

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.

@TheDevTwister
Copy link

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) Build Settings

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.

@krompaco
Copy link

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...

@krompaco
Copy link

Please make some noise in this issue to:
#742

Seems like documentation is completely missing dotnet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

4 participants