Skip to content

[Broken Build]: Working with msbuild and clickOnce profile on self-hosted github actions #11944

Open
@mayac-philips

Description

@mayac-philips

Issue Description

We have a clickOnce application which we want to build and publish it through CI/CD pipeline on Github Actions.
We use our own instances of servercore 2022.
No matter what we've tried the build is always failing with various errors.
When running the same commands cli locally on a PC with Visual Studio 2022 it does work.

When MSBuildEnableWorkloadResolver is false:
error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Deployment.DotNet.Releases, Version=2.0.0.0

When MSBuildEnableWorkloadResolver is true:
C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,3): error : Could not resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.

The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.

C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,3): error : MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" because directory "C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.SDK.WorkloadAutoImportPropsLocator\Sdk" did not exist.

List components:
.NET SDK:
Version: 9.0.200
Commit: 90e8b202f2
Workload version: 9.0.200-manifests.87b8cca8
MSBuild version: 17.13.8+cbc39bea8

Runtime Environment:
OS Name: Windows
OS Version: 10.0.20348
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.200\

.NET workloads installed:
Installation Source: SDK 9.0.200
Manifest Version: 18.4.9289/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.4.9289\WorkloadManifest.json
Install Type: FileBased

[maui-windows]
Installation Source: SDK 9.0.200
Manifest Version: 9.0.51/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.51\WorkloadManifest.json
Install Type: FileBased

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.2
Architecture: x64
Commit: 80aa709f5d

.NET SDKs installed:
9.0.200 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [C:\Program Files\dotnet]

global.json file:
C:\actions-runner_work\project_name\project_name\global.json

Steps to Reproduce

  1. setup dotnet 9.0.202 with setup-dotnet
  2. install msbuild with extra tools
choco install visualstudio2022buildtools -y `  --package-parameters "--add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.ClickOnce --includeRecommended --quiet --norestart" ` --no-progress`
3.  install workloads:

dotnet workload install maccatalyst --version 9.0.200
            dotnet workload install maui-windows --version 9.0.200
dotnet workload update
dotnet workload restore

4. dotnet restore

dotnet nuget locals all --clear
     dotnet clean
     dotnet restore --locked-mode
     dotnet list package

5. build
 msbuild -p:PublishProfile=$profile `

            /t:Publish             /p:Configuration=Release
            /p:PublishProtocol=ClickOnce             /p:Install=true
            /p:IsWebBootstrapper=true             /p:InstallFrom=Web
            /p:TargetFramework=net9.0-windows `
            -verbosity:detailed

env:
MSBuildSDKsPath: "C:\Program Files\dotnet\sdk\9.0.200\Sdks"
MSBuildEnableWorkloadResolver: false
MSBuildExtensionsPath: "C:\Program Files\dotnet\sdk\9.0.200\Sdks"
MSBuildExtensionsPath32: "C:\Program Files\dotnet\sdk\9.0.200\Sdks"



### Expected Behavior

Msbuild to be able to run and build the cllickOnce application based on given profile.

### Actual Behavior

The build always fails when running on Github Actions,  although does pass when running locally.

### Ask us questions

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ClickOnceIssues related to ClickOnce, including the SignFile task.triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions