-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Update file-based apps reference article #50604
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
base: main
Are you sure you want to change the base?
Conversation
| ``` | ||
|
|
||
| The SDK generates a temporary project and builds your application. | ||
| The SDK generates a virtual project and builds your application. The default path for the build output is `./bin/<configuration>/<framework>/`. Use the `--output` option to specify a different path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default output path is in the user profile directory and generally isn't visible to the user by default (it's in the directory cleared by the dotnet clean file-based-apps command, e.g. for Windows C:\Users\<username>\AppData\Local\Temp\dotnet\runfile\<appname>-<appfilesha>\bin\debug\). Easiest way to see it is by using the -getProperty option, e.g.:
> dotnet build hello.cs -getProperty=OutputPath
C:\Users\username\AppData\Local\Temp\dotnet\runfile\hello-1b946725adaab7fbf948510079efbd804fd48dbeeb8f1fa765bb7197dd8d5e73\bin\debug\Using --output will change the output path for that build invocation, or the user can set the OutputPath property in their app using the directive:
#:property OutputPath=./output| ``` | ||
|
|
||
| File-based apps enable native AOT publishing by default, producing optimized, self-contained executables. | ||
| The default location of the executable is an `artifacts` directory next to the `.cs` file, with a subdirectory named after the application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed by using --output again.
| ``` | ||
|
|
||
| This command creates a `.csproj` file with equivalent SDK and properties. All `#` directives are removed from the `.cs` file and turned into elements in the corresponding `.csproj` file. | ||
| This command creates a `.csproj` file with equivalent SDK and properties. The command removes all `#:` directives from the `.cs` file and turns them into elements in the corresponding `.csproj` file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to make it clear the original .cs file is left untouched, and that the created project file is placed in a directory next to the original .cs file, along with a copy of the original .cs file with the #: directives removed.
| ## Build caching | ||
|
|
||
| The .NET SDK caches build outputs to improve performance on subsequent builds. File-based apps participate in this caching system. | ||
| The .NET SDK caches build outputs to improve performance on subsequent builds. This caching system is unique to file-based apps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The .NET SDK caches build outputs to improve performance on subsequent builds. This caching system is unique to file-based apps. | |
| The .NET SDK caches build outputs to improve performance on subsequent invocations of `dotnet run`. This caching system is unique to file-based apps. |
| - Directive configuration. | ||
| - SDK version. | ||
| - Implicit build files. | ||
| - SDK version. Implicit build files existence and content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - SDK version. Implicit build files existence and content. | |
| - SDK version. | |
| - Implicit build files existence and content. |
DamianEdwards
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Left a few comments.
Summary
Address comments from review feedback in: #50371
This pull request updates the documentation for file-based .NET apps, focusing on clarifying CLI usage, improving explanations of build and caching behavior, and providing more precise instructions for advanced scenarios. The changes aim to make the documentation more accurate and user-friendly by refining command syntax, clarifying default behaviors, and adding details on cache management and publishing.
CLI Command Usage and Syntax Improvements:
dotnet run, emphasizing the use of the--fileoption and providing updated examples for passing arguments, including the recommended use of--to separate app arguments.--daysfor cache cleanup and clarified the difference between deleting artifacts for a single file and a directory.NuGet and SDK Reference Syntax:
#:package Serilog version="3.1.1"to#:package [email protected]for consistency, and added an example for referencing a specific SDK version.User Secrets and Advanced Features:
--fileoption instead of--project, and added an example for listing secrets.Build Output and Caching Behavior:
Internal previews