Skip to content

Conversation

radical
Copy link
Member

@radical radical commented May 15, 2025

What broke?

Template tests run dotnet test --list-tests to get the list of tests so they can
be run on separate helix jobs. This run of dotnet failed the builds on
azdo
with:

  You must install or update .NET to run this application.

  App: /mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64)
  .NET location: /usr/lib/dotnet

  The following frameworks were found:
    6.0.36 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

  Learn about framework resolution:
  https://aka.ms/dotnet/app-launch-failed

  To install missing framework, download:
  https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=ubuntu.22.04-x64
/mnt/vss/_work/1/s/tests/Directory.Build.targets(39,5): error MSB3073: The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests" --filter-no>
 ##[error]tests/Directory.Build.targets(39,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire>

Why did it break?

[1] added a change where that dotnet test was run with
EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86",
so it does not use the system dotnet. This helped on Azdo builds where
we have older system dotnet (6.0x).

Then [2] removed that change so the system dotnet on github actions
could be used because a newer one was being installed. But this now
broke the Azdo builds.

To fix this set the DOTNET_ROOT on Azdo builds, so the correct dotnet is
used.

References:
1.
commit 0af9e78
Author: Youssef Victor youssefvictor00@gmail.com
Date: Sat Apr 19 14:34:54 2025 +0200

Revert to MTP and disable server capability as a workaround (#8833)
commit 6ca2de945a44868673e12fa43e2a76055c34bf4a
Author: Ankit Jain <radical@gmail.com>
Date:   Wed May 14 11:39:18 2025 -0400

    [CI] Add PR validation on macOS (#9287)

@github-actions github-actions bot added the area-engineering-systems infrastructure helix infra engineering repo stuff label May 15, 2025
@radical
Copy link
Member Author

radical commented May 15, 2025

These need to be validated before merging:

  • Tests workflow on GH
  • Azdo public pipeline
  • Azdo internal pipeline

 ## What broke?

Template tests run `dotnet test --list-tests` to get the list of tests so they can
be run on separate helix jobs. This run of `dotnet` failed the builds on
azdo with:

```
  You must install or update .NET to run this application.

  App: /mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64)
  .NET location: /usr/lib/dotnet

  The following frameworks were found:
    6.0.36 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

  Learn about framework resolution:
  https://aka.ms/dotnet/app-launch-failed

  To install missing framework, download:
  https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=ubuntu.22.04-x64
/mnt/vss/_work/1/s/tests/Directory.Build.targets(39,5): error MSB3073: The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests" --filter-no>
 ##[error]tests/Directory.Build.targets(39,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire>
```

 ## Why did it break?

[1] added a change where that `dotnet test` was run with
`EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86"`,
so it does not use the system dotnet. This helped on Azdo builds where
we have older system dotnet (6.0x).

Then [2] removed that change so the system dotnet on github actions
could be used because a newer one was being installed. But this now
broke the Azdo builds.

To fix this set the DOTNET_ROOT on Azdo builds, so the correct dotnet is
used.

References:
1.
commit 0af9e78
Author: Youssef Victor <youssefvictor00@gmail.com>
Date:   Sat Apr 19 14:34:54 2025 +0200

    Revert to MTP and disable server capability as a workaround (dotnet#8833)

2.
```
commit 6ca2de9
Author: Ankit Jain <radical@gmail.com>
Date:   Wed May 14 11:39:18 2025 -0400

    [CI] Add PR validation on macOS (dotnet#9287)
```
@radical radical force-pushed the fix-azdo-main branch 2 times, most recently from 1d49b4f to 953a381 Compare May 15, 2025 21:31
@radical radical marked this pull request as ready for review May 15, 2025 22:25
@Copilot Copilot AI review requested due to automatic review settings May 15, 2025 22:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the Azure DevOps builds by ensuring that the correct .NET installation is used for the test and build steps.

  • Updated the test step environment variable to set DOTNET_ROOT
  • Added/updated the DOTNET_ROOT environment variable for the build step
Comments suppressed due to low confidence (1)

eng/pipelines/templates/BuildAndTest.yml:64

  • [nitpick] The path separators for DOTNET_ROOT differ between the test step (using backslashes) and the build step (using forward slashes). Consider using consistent path separators to improve readability and reduce potential issues in cross-platform environments.
+        DOTNET_ROOT: $(Build.SourcesDirectory)\ .dotnet

Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if it works

@radical
Copy link
Member Author

radical commented May 15, 2025

@radical
Copy link
Member Author

radical commented May 15, 2025

@radical radical merged commit 49b1fd3 into dotnet:main May 15, 2025
257 of 258 checks passed
@radical radical deleted the fix-azdo-main branch May 15, 2025 23:32
@RussKie
Copy link
Contributor

RussKie commented May 16, 2025

Should #9261 be reinstated now?

@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-engineering-systems infrastructure helix infra engineering repo stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants