Mike Ward
Mike Ward

Reputation: 3321

.NET 6.0 Preview, dotnet bundle, Github action fails

Given this (abbreviated) Github workflow

   steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v2    
    - uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.100-preview.4.21255.9'
        include-prerelease: true
    - uses: darenm/Setup-VSTest@v1

    - name: Build
      run: dotnet publish SendExplorerPlus.sln /p:Configuration=Release /p:PublishProfile=local /verbosity:minimal

I get an error when it tries to run dotnet bundle

Run dotnet publish SendExplorerPlus.sln /p:Configuration=Release /p:PublishProfile=local /verbosity:minimal

...
  Determining projects to restore...
  Restored D:\a\sendexplorer\sendexplorer\Portal2\Portal2.csproj (in 10.21 sec).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  Portal2 -> D:\a\sendexplorer\sendexplorer\Portal2\bin\Release\net6.0\Portal2.dll
  It was not possible to find any compatible framework version
  The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
    - The following frameworks were found:
        6.0.0-preview.4.21253.7 at [C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\shared\Microsoft.NETCore.App]
  
  You can resolve the problem by installing the specified framework and/or SDK.
  
  The specified framework can be found at:
     - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=win10-x64
D:\a\sendexplorer\sendexplorer\Portal2\Portal2.csproj(148,5): error MSB3073: The command "dotnet bundle" exited with code -2147450730.
Error: Process completed with exit code 1.

I've played wack-a-mole with the workflow for the past couple of hours and can't find a workaround. Any ideas?

Upvotes: 4

Views: 1417

Answers (1)

Mike Ward
Mike Ward

Reputation: 3321

I resolved this by adding a specific version of the .NET SDK. Namely 2.2.106. Tried other versions of the SDK but this was the only one I found to work.

    - uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '2.2.106'
    - uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.100-preview.4.21255.9'
        include-prerelease: true

Upvotes: 2

Related Questions