Skip to content

Commit 87f5960

Browse files
authored
Merge branch 'main' into darc-main-9c426504-cf32-4925-b1a9-d5d072fa1d05
2 parents 7fe39c5 + 1fe48e3 commit 87f5960

File tree

81 files changed

+1625
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1625
-559
lines changed

.vsts-ci.yml

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,9 @@ extends:
6464
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
6565
parameters:
6666
containers:
67-
alpine322Amd64:
68-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-amd64
69-
centosStream9:
70-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9
71-
debian12Amd64:
72-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-gcc15-amd64
73-
fedora39:
74-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-39
75-
mariner20CrossArm:
76-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm
67+
azureLinux30Net10BuildAmd64:
68+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-build-amd64
69+
7770
sdl:
7871
sourceAnalysisPool:
7972
name: $(DncEngInternalBuildPool)
@@ -162,60 +155,44 @@ extends:
162155
timeoutInMinutes: 90
163156
linuxJobParameterSets:
164157
### OFFICIAL ###
165-
# Note: These builds are also portable like the Portable category, but that category uses containers, and doesn't publish zips and tarballs.
158+
# Note: These builds are also glibc like the glibc category, but that category uses containers, and doesn't publish zips and tarballs.
166159
- categoryName: Official
167160
publishArgument: $(_publishArgument)
168161
officialBuildProperties: $(_officialBuildProperties)
169-
osProperties: $(linuxOsPortableProperties)
162+
osProperties: $(linuxOsglibcProperties)
170163
runTests: false
171164
- categoryName: Official
172165
targetArchitecture: arm
173166
runtimeIdentifier: linux-arm
174167
publishArgument: $(_publishArgument)
175168
officialBuildProperties: $(_officialBuildProperties)
176-
osProperties: $(linuxOsPortableProperties)
169+
osProperties: $(linuxOsglibcProperties)
177170
runTests: false
178171
- categoryName: Official
179172
targetArchitecture: arm64
180173
runtimeIdentifier: linux-arm64
181174
publishArgument: $(_publishArgument)
182175
officialBuildProperties: $(_officialBuildProperties)
183-
osProperties: $(linuxOsPortableProperties)
184-
runTests: false
185-
### PORTABLE ###
186-
- categoryName: Portable
187-
# Do not publish zips and tarballs. The linux-x64 binaries are already published by Official.
188-
publishArgument: $(_publishArgument) /p:PublishBinariesAndBadge=false
189-
officialBuildProperties: $(_officialBuildProperties)
190-
osProperties: $(linuxOsPortableProperties) /p:BuildSdkDeb=true
191-
runTests: false
192-
- categoryName: Portable
193-
targetArchitecture: arm64
194-
runtimeIdentifier: linux-arm64
195-
# Do not publish zips and tarballs. The linux-arm64 binaries are already published by Official.
196-
publishArgument: $(_publishArgument) /p:PublishBinariesAndBadge=false
197-
officialBuildProperties: $(_officialBuildProperties)
198-
osProperties: $(linuxOsPortableProperties) /p:BuildSdkDeb=true
176+
osProperties: $(linuxOsglibcProperties)
199177
runTests: false
200-
- categoryName: Portable
201-
container: centosStream9
178+
### glibc ###
179+
- categoryName: glibc
202180
# Do not publish zips and tarballs. The linux-x64 binaries are already published by Official.
203181
publishArgument: $(_publishArgument) /p:PublishBinariesAndBadge=false
204182
officialBuildProperties: $(_officialBuildProperties)
205-
osProperties: $(linuxOsPortableProperties) /p:IsRPMBasedDistro=true
183+
osProperties: $(linuxOsglibcProperties) /p:BuildSdkDeb=true
206184
runTests: false
207-
- categoryName: Portable
208-
container: centosStream9
185+
- categoryName: glibc
209186
targetArchitecture: arm64
210187
runtimeIdentifier: linux-arm64
211188
# Do not publish zips and tarballs. The linux-arm64 binaries are already published by Official.
212189
publishArgument: $(_publishArgument) /p:PublishBinariesAndBadge=false
213190
officialBuildProperties: $(_officialBuildProperties)
214-
osProperties: $(linuxOsPortableProperties) /p:IsRPMBasedDistro=true
191+
osProperties: $(linuxOsglibcProperties) /p:BuildSdkDeb=true
215192
runTests: false
216-
### MUSL ###
217-
- categoryName: Musl
218-
container: alpine322Amd64
193+
### musl ###
194+
- categoryName: musl
195+
container: azureLinux30Net10BuildAmd64
219196
runtimeIdentifier: linux-musl-x64
220197
publishArgument: $(_publishArgument)
221198
officialBuildProperties: $(_officialBuildProperties)
@@ -224,15 +201,15 @@ extends:
224201
# SBOM generation is not supported for alpine.
225202
enableSbom: false
226203
runTests: false
227-
- categoryName: Musl
228-
container: mariner20CrossArm
204+
- categoryName: musl
205+
container: azureLinux30Net10BuildAmd64
229206
targetArchitecture: arm
230207
runtimeIdentifier: linux-musl-arm
231208
publishArgument: $(_publishArgument)
232209
officialBuildProperties: $(_officialBuildProperties)
233210
osProperties: /p:OSName=linux-musl
234211
runTests: false
235-
- categoryName: Musl
212+
- categoryName: musl
236213
targetArchitecture: arm64
237214
runtimeIdentifier: linux-musl-arm64
238215
publishArgument: $(_publishArgument)

.vsts-pr.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,8 @@ variables:
2727

2828
resources:
2929
containers:
30-
- container: alpine322Amd64
31-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-amd64
32-
- container: centosStream9
33-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9
34-
- container: debian12Amd64
35-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-gcc15-amd64
36-
- container: fedora39
37-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-39
38-
- container: ubuntu2204DebPkg
39-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-debpkg
30+
- container: azureLinux30Net10BuildAmd64
31+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-build-amd64
4032

4133
stages:
4234
############### BUILD STAGE ###############

documentation/general/dotnet-run-file.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ The [guiding principle](#guiding-principle) implies that we can think of file-ba
2828
The implicit project file is the default project that would be created by running `dotnet new console`.
2929
This means that the behavior of `dotnet run file.cs` can change between SDK versions if the `dotnet new console` template changes.
3030

31+
Additionally, the implicit project file has the following customizations:
32+
33+
- `PublishAot` is set to `true`, see [`dotnet publish file.cs`](#other-commands) for more details.
34+
35+
- [File-level directives](#directives-for-project-metadata) are applied.
36+
37+
- The following are virtual only, i.e., not preserved after [converting to a project](#grow-up):
38+
39+
- `ArtifactsPath` is set to a [temp directory](#build-outputs).
40+
41+
- `RuntimeHostConfigurationOption`s are set for `EntryPointFilePath` and `EntryPointFileDirectoryPath` which can be accessed in the app via `AppContext`:
42+
43+
```cs
44+
string? filePath = AppContext.GetData("EntryPointFilePath") as string;
45+
string? directoryPath = AppContext.GetData("EntryPointFileDirectoryPath") as string;
46+
```
47+
3148
## Grow up
3249

3350
When file-based programs reach an inflection point where build customizations in a project file are needed,
@@ -60,6 +77,8 @@ The file-based build and run kicks in only when:
6077
- a project file cannot be found (in the current directory or via the `--project` option), and
6178
- if the target file exists, and has the `.cs` file extension or contents that start with `#!`.
6279

80+
Otherwise, project-based `dotnet run` fallback is used and you might get an error like "Couldn't find a project to run."
81+
6382
File-based programs are processed by `dotnet run` equivalently to project-based programs unless specified otherwise in this document.
6483
For example, the remaining command-line arguments after the first argument (the target path) are passed through to the target app
6584
(except for the arguments recognized by `dotnet run` unless they are after the `--` separator)
@@ -179,20 +198,28 @@ Other directives result in an error, reserving them for future use.
179198
#:project ../MyLibrary
180199
```
181200

182-
The value must be separated from the kind (`package`/`sdk`/`property`) of the directive by whitespace
183-
and any leading and trailing white space is not considered part of the value.
184-
Any value can optionally have two parts separated by `@` in case of `package`/`sdk` or `=` in case of `property`
185-
and whitespace is trimmed from the two parts around the separator.
186-
The value of the first `#:sdk` is injected into `<Project Sdk="{0}">` with the separator (if any) replaced with `/`,
187-
and the subsequent `#:sdk` directive values are split by the separator and injected as `<Sdk Name="{0}" Version="{1}" />` elements (or without the `Version` attribute if there is no separator).
188-
It is an error if the first part (name) is empty (the version is allowed to be empty, but that results in empty `Version=""`).
189-
The value of `#:property` is split by the separator and injected as `<{0}>{1}</{0}>` in a `<PropertyGroup>`.
190-
It is an error if no separator appears in the value or if the first part (property name) is empty (the property value is allowed to be empty) or contains invalid characters.
191-
The value of `#:package` is split by the separator and injected as `<PackageReference Include="{0}" Version="{1}">` (or without the `Version` attribute if there is no separator) in an `<ItemGroup>`.
192-
It is an error if the first part (package name) is empty (the package version is allowed to be empty, but that results in empty `Version=""`).
193-
The value of `#:project` is injected as `<ProjectReference Include="{0}" />` in an `<ItemGroup>`.
194-
If the value points to an existing directory, a project file is found inside that directory and its path is used instead
195-
(because `ProjectReference` items don't support directory paths).
201+
Each directive has a kind (e.g., `package`), a name (e.g., `System.CommandLine`), a separator (e.g., `@`), and a value (e.g., the package version).
202+
The value is required for `#:property`, optional for `#:package`/`#:sdk`, and disallowed for `#:project`.
203+
204+
The name must be separated from the kind (`package`/`sdk`/`property`) of the directive by whitespace
205+
and any leading and trailing white space is not considered part of the name and value.
206+
207+
The directives are processed as follows:
208+
209+
- The name and value of the first `#:sdk` is injected into `<Project Sdk="{0}/{1}">` (or just `<Project Sdk="{0}">` if it has no value),
210+
and the subsequent `#:sdk` directive names and values are injected as `<Sdk Name="{0}" Version="{1}" />` elements (or without the `Version` attribute if it has no value).
211+
It is an error if the name is empty (the version is allowed to be empty, but that results in empty `Version=""`).
212+
213+
- A `#:property` is injected as `<{0}>{1}</{0}>` in a `<PropertyGroup>`.
214+
It is an error if property does not have a value or if its name is empty (the value is allowed to be empty) or contains invalid characters.
215+
216+
- A `#:package` is injected as `<PackageReference Include="{0}" Version="{1}">` (or without the `Version` attribute if it has no value) in an `<ItemGroup>`.
217+
It is an error if its name is empty (the value, i.e., package version, is allowed to be empty, but that results in empty `Version=""`).
218+
219+
- A `#:project` is injected as `<ProjectReference Include="{0}" />` in an `<ItemGroup>`.
220+
If the path points to an existing directory, a project file is found inside that directory and its path is used instead
221+
(because `ProjectReference` items don't support directory paths).
222+
An error is reported if zero or more than one projects are found in the directory, just like `dotnet reference add` would do.
196223

197224
Because these directives are limited by the C# language to only appear before the first "C# token" and any `#if`,
198225
dotnet CLI can look for them via a regex or Roslyn lexer without any knowledge of defined conditional symbols
@@ -235,7 +262,13 @@ The build is performed using MSBuild APIs on in-memory project files.
235262

236263
### Optimizations
237264

238-
MSBuild invocation can be skipped in subsequent `dotnet run file.cs` invocations if an up-to-date check detects that inputs didn't change.
265+
If an up-to-date check detects that inputs didn't change in subsequent `dotnet run file.cs` invocations,
266+
building is skipped (as if `--no-build` option has been passed).
267+
The up-to-date check is not 100% precise (e.g., files imported through an implicit build file are not considered).
268+
It is possible to enforce a full build using `--no-cache` flag or `dotnet build file.cs`.
269+
Environment variable [`DOTNET_CLI_CONTEXT_VERBOSE=true`][verbose-env] can be used to get more details about caching decisions made by `dotnet run file.cs`.
270+
271+
There are multiple optimization levels - skipping build altogether, running just the C# compiler, or running full MSBuild.
239272
We always need to re-run MSBuild if implicit build files like `Directory.Build.props` change but
240273
from `.cs` files, the only relevant MSBuild inputs are the `#:` directives,
241274
hence we can first check the `.cs` file timestamps and for those that have changed, compare the sets of `#:` directives.
@@ -351,6 +384,7 @@ Instead of implicitly including files from the target directory, the importing c
351384
-->
352385

353386
[artifacts-output]: https://learn.microsoft.com/dotnet/core/sdk/artifacts-output
387+
[verbose-env]: https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_cli_context_
354388
[ignored-directives]: https://github.com/dotnet/csharplang/blob/main/proposals/ignored-directives.md
355389
[shebang]: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
356390
[temp-guidelines]: https://github.com/dotnet/runtime/blob/d0e6ce8332a514d70b635ca4829bf863157256fe/docs/design/security/unix-tmp.md

documentation/general/workloads/workload-diagnosis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _Installation rollback failed: Workload manifest dependency 'Microsoft.NET.Workl
2626

2727
1. Workload is not installed. Try running `dotnet workload restore`. If that does not work, try running `dotnet build -getItem:MissingWorkloadPack` to determine what workload packs are missing. Our workload detection logic could be wrong and you could need a different workload than we list. This call should provide the pack we need and file an issue in the SDK repo with this information.
2828
_NETSDK1147: To build this project, the following workloads must be installed:_
29-
2. You installed workloads previously but now your workload templates are missing (Aspire and MAUI templates are installed by the workloads). This could be because your workloads were installed correctly at some point in the past but are now out of sync.
29+
2. You installed workloads previously but now your workload templates are missing (MAUI templates are installed by the workloads). This could be because your workloads were installed correctly at some point in the past but are now out of sync.
3030
1. You installed a new band of the SDK. Workloads are installed per band so installing a new SDK could lead to your workloads not working. [Workload versions](https://github.com/dotnet/designs/pull/294) should improve that.
3131
2. You installed a different workload from the dotnet CLI. We've improved this a few times but it's still possible to install a different workload which updates your workload manifests without updating your workloads. Please file a bug if this happens to you.
3232
3. You install a new version of Visual Studio that doesn't have worklaods selected. Visual Studio should include all available workloads so make sure to select them in Visual Studio setup.

eng/Badge.proj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<PropertyGroup>
1010
<!-- Replace '-' with '_' for os names like 'linux-musl' -->
1111
<VersionBadgeMoniker>$(OSName.Replace('-', '_'))_$(TargetArchitecture)</VersionBadgeMoniker>
12-
<VersionBadgeMoniker Condition="'$(IsLinuxPortable)' == 'true'">linux_$(TargetArchitecture)</VersionBadgeMoniker>
1312

1413
<VersionBadge>$(ArtifactsShippingPackagesDir)$(VersionBadgeMoniker)_$(Configuration)_version_badge.svg</VersionBadge>
1514
<VersionSvgTemplate>$(MSBuildThisFileDirectory)version_badge.svg</VersionSvgTemplate>

eng/Versions.props

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@
329329
<BenchmarkDotNetPackageVersion>0.14.0</BenchmarkDotNetPackageVersion>
330330
</PropertyGroup>
331331
<PropertyGroup Label="Workload manifest package versions">
332-
<AspireFeatureBand>8.0.100</AspireFeatureBand>
333-
<MicrosoftNETSdkAspireManifest80100PackageVersion>8.2.2</MicrosoftNETSdkAspireManifest80100PackageVersion>
334332
<MauiFeatureBand>10.0.100-preview.5</MauiFeatureBand>
335333
<MauiWorkloadManifestVersion>10.0.0-preview.5.25306.5</MauiWorkloadManifestVersion>
336334
<XamarinAndroidWorkloadManifestVersion>36.0.0-preview.5.116</XamarinAndroidWorkloadManifestVersion>

eng/cgmanifest.json

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)