Context: Github Actions is a CI/CD tool.
We can run dotnet build, dotnet test and things like that there.
It is different from Gitlab where we simply say
image: mcr.microsoft.com/dotnet/core/sdk:5.0
This is not an issue, more like a help request
as Github actions currently cannot into .NET 5 as far as I can tell
Corresponding issue on Github actions:
https://github.com/actions/setup-dotnet/issues/80
Special thanks to @danmosemsft for the hint to create a new issue as opposed to a comment on https://github.com/dotnet/runtime/issues/13257
Tagging @safern, @viktorhofer as an area owner
Demo Github actions yaml: https://github.com/kusl/mydotnet/blob/master/.github/workflows/dotnetcore.yml
hello @9034725985 it seems like you're implying here: https://github.com/kusl/mydotnet/blob/master/.github/workflows/dotnetcore.yml#L19 that the dotnet-version is 5.0
however that is not a valid version of the SDK.
From looking at the code in: https://github.com/actions/setup-dotnet/blob/00f2601192e8671356cd7c79a137000885fa145a/src/installer.ts#L198 it uses a json file which we update everytime we publish a new version of the dotnet-sdk
.
So this seems to behave pretty much just like the UseDotNet task in AzureDevops. https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
For 5.0 the release json of available .NET SDKs is this one: https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/5.0/releases.json
So basically you need to change your dotnet-version to: 5.0.100-preview.2.20176.6
which is listed as the latest sdk in that json.
Also, I believe if you don't want to specify a specific version, you can pass 5.x
as the dotnet-version and it will install the latest sdk version listed on that json.
Closing the issue as it has been answered, we can continue the thread if needed even if closed.
Thank you @safern
Using '5.0.100-preview.2.20176.6' works but 5.x does not. It would be nice if I could use 5.x or something and it just used the latest available 5.x version. Maybe that can't happen because .NET 5 isn't released?
Yeah I guess it doesn't work because we haven't shipped any stable version. Probably the .x
feature only works with released, stable versions.
I found out there's an option to make .x
work with prereleases and suggested an option to enable that behavior here: https://github.com/actions/setup-dotnet/issues/105
@9034725985 If you don't want to use a preview version anymore, 5.0.100
as version tag also works :) You can find the version by clicking the download link on https://dotnet.microsoft.com/download/dotnet/5.0
or use the version from the title or Full Version
property for previews and release candidates. :)
Most helpful comment
@9034725985 If you don't want to use a preview version anymore,
5.0.100
as version tag also works :) You can find the version by clicking the download link onhttps://dotnet.microsoft.com/download/dotnet/5.0
or use the version from the title orFull Version
property for previews and release candidates. :)