Wątek przeniesiony 2022-05-17 12:25 z Python przez Riddle.

Środowisko uruchomieniowe .NET w Github Actions

0

Mam problem z pipeline na github.

Stworzyłem repo dodałem do niego projekt z C# Windows Forms .net Framework 4.8 i dodałem plik .yaml i pipeline się bez problemu zbudował.

Następnie do repo dodałem XUnit test 6.0
I pipielinie nie chciał się już zbudować a na Visual Studio się bez problemu buduje

Nie wiem czy nie jest to czasem spowodowane przez wersje projektów albo przez to że korzystano z Visual Studio 2022

dotnet.yaml:

name: .NET

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v2
      with:
        dotnet-version: 6.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --no-restore
    - name: Test
      run: dotnet test --no-build --verbosity normal

Błąd:

Run dotnet build --no-restore
6
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
7
Copyright (C) Microsoft Corporation. All rights reserved.
8

9
  UnitTest -> D:\a\WarehouseCS\WarehouseCS\UnitTest\bin\Debug\net6.0\UnitTest.dll
10
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "NET" and architecture "x86".  Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\MSBuild.dll" exists and can be run. [D:\a\WarehouseCS\WarehouseCS\Warehouse\Warehouse.csproj]
11
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\Microsoft.Common.CurrentVersion.targets(3284,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type. [D:\a\WarehouseCS\WarehouseCS\Warehouse\Warehouse.csproj]
12

13
Build FAILED.
14

15
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4216: Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "NET" and architecture "x86".  Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\MSBuild.dll" exists and can be run. [D:\a\WarehouseCS\WarehouseCS\Warehouse\Warehouse.csproj]
16
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.300\Microsoft.Common.CurrentVersion.targets(3284,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type. [D:\a\WarehouseCS\WarehouseCS\Warehouse\Warehouse.csproj]
17
    0 Warning(s)
18
    2 Error(s)
19

20
Time Elapsed 00:00:03.62
21
Error: Process completed with exit code 1.

Jak mogę to naprawić?

0

Jesteś pewien, że się zbudował bez testów poprawnie? Próbujesz zbudować projekt na starym .NET Framework 4.8 za pomocą nowego .NET 6, tak się da? Jakie masz komunikaty jakbyś spróbował lokalnie odpalić "dotnet build" w swoim repozytorium?

1 użytkowników online, w tym zalogowanych: 0, gości: 1