microsoft / microsoft/aspire

`aspire update` ignores global.json for Aspire.AppHost.Sdk version

Open
#15,904 1 comment 1 reaction 0 assignees View on GitHub
area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

When using the `aspire update` to upgrade a solution to the latest version, the sdk version in the global.json file is not updated.

This applies especially when the `Apphost.csproj` defines the Aspire.Hosting.Sdk without a version. Like so: ``
Then in the global.json have a definition for:
```
"msbuild-sdks": {
"Aspire.AppHost.Sdk": "13.2.1"
}
```

### Expected Behavior

I would have expected the version of Aspire to be updated in the `msbuild-sdks` property of the global.json file.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version info

_No response_

### Anything else?

**Considerations:**
The global.json could potentially be outside of the actual project's directory. Just like `Directory.Build.props` or `Directory.Packages.props` any file that can be reached by searching directories upwards recursively will be used to resolve the Sdk version.

This means updating the global.json from inside the project directory of one Apphost could break a different Apphost by effectifely updating its Sdk version as well.

The same scenario could already happen today with Central Package Management. Breaking a different Apphost by updating another Apphost using the same `Directory.Packages.props` file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.