github-actions - .NET 6.0 预览版、dotnet 包、Github 操作失败

标签 github-actions .net-6.0

鉴于此(缩写)Github 工作流程

   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

尝试运行时出现错误 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.
在过去的几个小时里,我一直在使用工作流程玩怪诞,但找不到解决方法。有任何想法吗?

最佳答案

我通过添加特定版本的 .NET SDK 解决了这个问题。即2.2.106 .尝试了其他版本的 SDK,但这是我发现的唯一一个版本。

    - 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

关于github-actions - .NET 6.0 预览版、dotnet 包、Github 操作失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67873508/

相关文章:

javascript - 在另一个存储库中使用该操作时如何访问 GitHub Action 存储库的文件?

asp.net-core-webapi - 如何在 ASP.NET Core 6 中使用 DateOnly/TimeOnly 查询参数?

azure - 尝试通过 https ://xxx. scm.azurewebsites.net/api/zipdeploy 发布 ZIP 文件失败,HTTP 状态代码为禁止

azure - 我应该将 Azure 应用程序注册证书放置在本地服务器上的哪个证书存储中

github - 如何获取最新的 PR 数据,特别是运行 YAML 作业时的里程碑?

c++ - 如何使用 Github Actions 中的 MSVC 编译器?

Github Action 机器人推送到 gh-pages 导致页面构建失败

c# - 为什么这个特定的 PowerShell 命令在 .NET 6 中失败(它曾经在 .NET 4 中工作)

c# - 在 .NET Maui 中写入文件

github-actions - 如何在 GitHub Actions config yaml 中集中(DRY)字符串?