0

我有一个 File New WinForms Net6 应用程序。我正在尝试使用 GitHub Action 发布 MSIX。

在本地,此命令效果很好:

msbuild WinFomrsMSIX.AppPkg\WinFomrsMSIX.AppPkg.wapproj /restore /t:Publish /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxBundlePlatforms="x64" /p:configuration=Release /p:GenerateAppxPackageOnBuild=true /p:Platform=x64

在 GitHub Actions 上,我收到以下错误:

The name 'ApplicationConfiguration' does not exist in the current context

这里有什么问题?

带有操作的公共回购: https ://github.com/aherrick/WinFormsMSIX/actions

全面行动:

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:

  build:

    # strategy:
    #   matrix:
    #     configuration: [Release]
    #     platform: [x64]

    runs-on: windows-latest  # For a list of available runner types, refer to
                             # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    #Install the .NET Core workload
    - name: Install .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
        include-prerelease: true
      # env:
      #   DOTNET_INSTALL_DIR: 'C:\Program Files\dotnet'

    # Add  MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
    - name: Setup MSBuild.exe
      uses: microsoft/setup-msbuild@v1.0.2

 
    - name: Publish
      run: msbuild WinFomrsMSIX.AppPkg\WinFomrsMSIX.AppPkg.wapproj /restore /t:Publish /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxBundlePlatforms="x64" /p:configuration=Release /p:GenerateAppxPackageOnBuild=true /p:Platform=x64

原始日志:

CSC : warning CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.2\analyzers\dotnet\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
CSC : warning CS8032: An instance of analyzer System.Windows.Forms.Analyzers.AppManifestAnalyzer cannot be created from C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.2\analyzers\dotnet\System.Windows.Forms.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
CSC : warning CS8032: An instance of analyzer System.Windows.Forms.Generators.ApplicationConfigurationGenerator cannot be created from C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.2\analyzers\dotnet\cs\System.Windows.Forms.Analyzers.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
Warning: D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\obj\x64\Release\net6.0-windows\win-x64\.NETCoreApp,Version=v6.0.AssemblyAttributes.cs(2,7): warning CS0105: The using directive for 'System' appeared previously in this namespace [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
Warning: D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\obj\x64\Release\net6.0-windows\win-x64\WinFormsMSIX.AssemblyInfo.cs(11,7): warning CS0105: The using directive for 'System' appeared previously in this namespace [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
Error: D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\Program.cs(13,13): error CS0103: The name 'ApplicationConfiguration' does not exist in the current context [D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj]
  CompilerServer: server - server processed compilation - c5311555-b34b-46d6-95b4-788912772db8
Done Building Project "D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj" (publish target(s)) -- FAILED.
Done Building Project "D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.AppPkg\WinFormsMSIX.AppPkg.wapproj" (Publish target(s)) -- FAILED.

Build FAILED.

"D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.AppPkg\WinFormsMSIX.AppPkg.wapproj" (Publish target) (1:7) ->
"D:\a\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX\WinFormsMSIX.csproj" (publish target) (2:13) ->
4

0 回答 0