Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global.json causes xharness to be confused about the version #1197

Open
amirvenus opened this issue May 1, 2024 · 2 comments
Open

global.json causes xharness to be confused about the version #1197

amirvenus opened this issue May 1, 2024 · 2 comments

Comments

@amirvenus
Copy link

Hi,

I have the following global.json in my solution folder:

{
  "sdk": {
    "version": "6.0.100",
    "rollForward": "latestMinor",
    "allowPrerelease": false
  }
}

However, when the pipeline runs, I get this error:

You must install .NET to run this application.

App: /Users/build/.dotnet/tools/xharness
Architecture: arm64
App host version: 6.0.29
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx.13-arm64&apphost_version=6.0.29

I can run the xharness through the macOS terminal without any problems.

 dotnet --list-sdks

6.0.100-preview.7.21379.14 [/Users/build/.dotnet/sdk]
6.0.421 [/Users/build/.dotnet/sdk]
8.0.204 [/Users/build/.dotnet/sdk]

 xharness version
XHarness command issued: version
xharness version 6.0.0-prerelease.24224.2+d1dd9c2ce3fc0b9358d2cda64c52d052d1a612c1 (Microsoft.DotNet.XHarness.CLI.exe)
@amirvenus amirvenus changed the title globa.json global.json causes xharness to be confused about the version May 1, 2024
@ivanpovazan
Copy link
Member

Hello @amirvenus,

Could you provide more information about your setup?
More specifically,

when the pipeline runs

Are you referring to the build pipeline?

If yes, can you provide a sample repro project / steps, and possibly a build log: (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#build-logs / https://msbuildlog.com ) ?

@vitek-karas
Copy link
Member

.NET location: Not found

I think this means that it didn't find any .NET - not just the right version. CI typically doesn't have .NET installed globally on the machine, it runs with a private (unzip) install in some "random" location. The xharness is run via the executable so it will need to have that location specified in DOTNET_ROOT env. variable otherwise it won't work.

@ivanpovazan how is the xharness executed? Is it done by hand by users, or we ship some kind of msbuild task which does that? If it's the latter, then we should implement the same behavior as other parts of SDK: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_host_path. This is the solution other pieces of the SDK use to correctly find .NET runtime even without DOTNET_ROOT - the idea being that running dotnet build already effectively specified the runtime location (that's where dotnet comes from), so everything spawned during the build should use that location. For complex reasons the CLI will not set DOTNET_ROOT, instead it sets DOTNET_HOST_PATH and other parts of the SDK recognize it and use it to locate the .NET.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants