Open mikependon opened 1 year ago
You can easily install .NET 8 Preview during the build with this simple script added to your appveyor.yml
:
install:
- ps: |
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
& $env:temp\dotnet-install.ps1 -Architecture x64 -Version '8.0.100-preview.2.23157.25' -InstallDir "$env:ProgramFiles\dotnet"
Thanks for this trick! It works actual as it builds the project and went passthrough to the next builds.
However, it then suddenly failing when the output binaries has been copied over and rebuilt before the actual test executions.
Suspecious as well of why I can see the log below, it sounds to me that the path is not correct. If it, then it sounds to me that the .NET 8 version is not instaled on the Node 1.
Project "C:\projects\repodb-yf1cx\RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj" (1) is building "C:\projects\repodb-yf1cx\RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj" (1:4) on node 1 (Build target(s)).
C:\Program Files\dotnet\sdk\7.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\projects\repodb-yf1cx\RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj::TargetFramework=net8.0]
Done Building Project "C:\projects\repodb-yf1cx\RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj" (Build target(s)) -- FAILED.
Done Building Project "C:\projects\repodb-yf1cx\RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj" (default targets) -- FAILED.
Here is the log file that contains the error. (File: log.txt) Link: https://ci.appveyor.com/project/mikependon/repodb-yf1cx
Below is my YML file.
And below is on the site.
Try using dotnet msbuild
to build RepoDb.UnitTests.csproj
directly.
Where is that in the YAML? Was it the build:
section?
version: 1.0.{build}
branches:
only:
- master
image: Visual Studio 2022
configuration: Release
platform: Any CPU
install:
- ps: >-
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
& $env:temp\dotnet-install.ps1 -Architecture x64 -Version '8.0.100-preview.2.23157.25' -InstallDir "$env:ProgramFiles\dotnet"
before_build:
- cmd: dotnet restore RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj
build:
project: RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj
verbosity: normal
test_script:
- cmd: vstest.console /logger:Appveyor RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\bin\Release\net7.0\RepoDb.UnitTests.dll
Yes, replace "MSBuild" with "Script" and put there dotnet msbuild RepoDb.Core\RepoDb.Tests\RepoDb.UnitTests\RepoDb.UnitTests.csproj
The AppVeyor is just a critical integration point to my project and I am very thankful for your support. Few minutes back, and since the .NET 8 is still in a preview mode, I had decided to just revert the support for it (for now), as all my project builds are failing.
But, I will do test again by next week to see if this approach would work and will start reinstating the support to .NET 8.
Can be closed now. https://github.com/appveyor/ci/issues/3908
.NET 8 Preview has been made available to the public. I started to migrate my OSS library as well to target the
net8.0
TFM as well. Here is the link to the announcement: https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/Currently, the site is not supporting it, but it sounds to me an important one so the public can start test and integrate in advance.
Would it be possible to support this and thanks in advance.