Skip to content

Commit 97ec222

Browse files
author
Simon Zhao (BEYONDSOFT CONSULTING INC)
committed
Merge branch 'main' of https://github.com/dotnet/SDK into darc-main-835cd6c5-a3a2-4816-bd44-a1a27df4212f
2 parents 7672d71 + 37015b5 commit 97ec222

File tree

242 files changed

+4651
-1866
lines changed

Some content is hidden

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

242 files changed

+4651
-1866
lines changed

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
- name: Do an initial build to ensure all dependencies are restored
28+
continue-on-error: true
2829
run: |
2930
./build.sh
3031
- name: Put repo-local dotnet install on PATH

CODEOWNERS

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@
3434
/test/dotnet-format.UnitTests @arunchndr
3535

3636
# Area-NuGet
37-
/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package @dotnet/nuget-team
38-
/test/dotnet-add-package.Tests @dotnet/nuget-team
39-
/src/Cli/dotnet/commands/dotnet-nuget @dotnet/nuget-team
40-
/test/dotnet-nuget.UnitTests @dotnet/nuget-team
41-
/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package @dotnet/nuget-team
42-
/test/dotnet-list-package.Tests @dotnet/nuget-team
37+
/src/Cli/dotnet/Commands/NuGet @dotnet/nuget-team
38+
/src/Cli/dotnet/Commands/Pack @dotnet/nuget-team
39+
/src/Cli/dotnet/Commands/Package @dotnet/nuget-team
40+
/src/Cli/dotnet/Commands/Restore @dotnet/nuget-team
41+
/test/Microsoft.NET.Restore.Tests @dotnet/nuget-team
42+
/test/Microsoft.NET.Pack.Tests @dotnet/nuget-team
43+
/test/dotnet.Tests/CommandTests/NuGet @dotnet/nuget-team
44+
/test/dotnet.Tests/CommandTests/Pack @dotnet/nuget-team
45+
/test/dotnet.Tests/CommandTests/Package @dotnet/nuget-team
46+
/test/dotnet.Tests/CommandTests/Restore @dotnet/nuget-team
4347

4448
# Area-FSharp
4549
/src/Cli/dotnet/commands/dotnet-fsi @dotnet/fsharp

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<PackageVersion Include="System.Composition.Runtime" Version="$(SystemCompositionRuntimePackageVersion)" />
109109
<PackageVersion Include="System.Composition.TypedParts" Version="$(SystemCompositionTypedPartsPackageVersion)" />
110110
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerPackageVersion)" />
111+
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
111112
<PackageVersion Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1Version)" />
112113
<PackageVersion Include="System.IO.Hashing" Version="$(SystemIOHashingPackageVersion)" />
113114
<!-- System.Reflection.Metadata and System.Collections.Immutable cannot be pinned here because of hard dependencies within Roslyn on specific versions that have to work both here and in VS -->

documentation/general/dotnet-run-file.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Additionally, the implicit project file has the following customizations:
4545
string? directoryPath = AppContext.GetData("EntryPointFileDirectoryPath") as string;
4646
```
4747

48+
- `FileBasedProgram` property is set to `true` and can be used by SDK targets to detect file-based apps.
49+
4850
## Grow up
4951

5052
When file-based programs reach an inflection point where build customizations in a project file are needed,
@@ -78,6 +80,7 @@ The file-based build and run kicks in only when:
7880
- if the target file exists, and has the `.cs` file extension or contents that start with `#!`.
7981

8082
Otherwise, project-based `dotnet run` fallback is used and you might get an error like "Couldn't find a project to run."
83+
You can explicitly use the `--file` option to avoid the fallback behavior.
8184

8285
File-based programs are processed by `dotnet run` equivalently to project-based programs unless specified otherwise in this document.
8386
For example, the remaining command-line arguments after the first argument (the target path) are passed through to the target app
@@ -88,7 +91,7 @@ If a dash (`-`) is given instead of the target path (i.e., `dotnet run -`), the
8891
In this case, the current working directory is not used to search for other files (launch profiles, other sources in case of multi-file apps);
8992
the compilation consists solely of the single file read from the standard input.
9093

91-
`dotnet path.cs` is a shortcut for `dotnet run path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported).
94+
`dotnet path.cs` is a shortcut for `dotnet run --file path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported).
9295

9396
### Other commands
9497

@@ -100,6 +103,9 @@ To opt out, use `#:property PublishAot=false` directive in your `.cs` file.
100103

101104
Command `dotnet clean file.cs` can be used to clean build artifacts of the file-based program.
102105

106+
Commands `dotnet package add PackageName --file app.cs` and `dotnet package remove PackageName --file app.cs`
107+
can be used to manipulate `#:package` directives in the C# files, similarly to what the commands do for project-based apps.
108+
103109
## Entry points
104110

105111
If a file is given to `dotnet run`, it has to be an *entry-point file*, otherwise an error is reported.
@@ -306,7 +312,7 @@ would need to search for a file-based program in the current directory instead o
306312

307313
We could add a universal option that works with both project-based and file-based programs,
308314
like `dotnet run --directory ./dir/`. For inspiration, `dotnet test` also has a `--directory` option.
309-
Furthermore, users might expect there to be a `--file` option, as well. Both could be unified as `--path`.
315+
We already have a `--file` option. Both could be unified as `--path`.
310316

311317
If we want to also support [multi-entry-point scenarios](#multiple-entry-points),
312318
we might need an option like `dotnet run --entry ./dir/name` which would work for both `./dir/name.cs` and `./dir/name/name.csproj`.
@@ -376,8 +382,7 @@ We could also add `dotnet compile` command that would be the equivalent of `dotn
376382
`dotnet clean` could be extended to support cleaning all file-based app outputs,
377383
e.g., `dotnet clean --all-file-based-apps`.
378384

379-
Adding references via `dotnet package add`/`dotnet reference add` could be supported for file-based programs as well,
380-
i.e., the command would add a `#:package`/`#:project` directive to the top of a `.cs` file.
385+
More NuGet commands (like `dotnet nuget why` or `dotnet package list`) could be supported for file-based programs as well.
381386

382387
### Explicit importing
383388

eng/Packages.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<!-- Packages must be set to their package version property if it exists (ex. BenchmarkDotNetVersion) since source-build uses
55
these properties to override package versions if necessary. -->
66
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
7-
<PackageVersion Update="Verify.XUnit" Condition="'$(VerifyXUnitVersion)' != ''" Version="$(VerifyXUnitVersion)" />
8-
<PackageVersion Update="Verify.DiffPlex" Condition="'$(VerifyDiffPlexVersion)' != ''" Version="$(VerifyDiffPlexVersion)" />
7+
<PackageVersion Update="DiffPlex" Condition="'$(DiffPlexVersion)' != ''" Version="$(DiffPlexVersion)" />
98
<PackageVersion Update="FakeItEasy" Condition="'$(FakeItEasyVersion)' != ''" Version="$(FakeItEasyVersion)" />
9+
<PackageVersion Update="Verify.DiffPlex" Condition="'$(VerifyDiffPlexVersion)' != ''" Version="$(VerifyDiffPlexVersion)" />
10+
<PackageVersion Update="Verify.XUnit" Condition="'$(VerifyXUnitVersion)' != ''" Version="$(VerifyXUnitVersion)" />
1011
<PackageVersion Update="Wcwidth.Sources" Condition="'$(WcwidthSourcesVersion)' != ''" Version="$(WcwidthSourcesVersion)" />
1112
</ItemGroup>
1213
</Project>

eng/Version.Details.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- will get filled in the next backflow -->

0 commit comments

Comments
 (0)