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

Support --no-build option in serve target #832

Open
mrfelton opened this issue Feb 26, 2024 · 1 comment
Open

Support --no-build option in serve target #832

mrfelton opened this issue Feb 26, 2024 · 1 comment
Labels
enhancement New feature or request needs-triage This issue has yet to be looked over by a core team member

Comments

@mrfelton
Copy link
Contributor

Support --no-build option in serve target. If we know code has already been built, there is no point in trying to build it again before serving. But currently there is no way to disable that.

serve target should support noBuild option to pass --no-build flag to dotnet run, just as test target does.

dotnet run --help
Description:
  .NET Run Command

Usage:
  dotnet run [<applicationArguments>...] [options]

Arguments:
  <applicationArguments>  Arguments passed to the application that is being run. []

Options:
  -c, --configuration <CONFIGURATION>     The configuration to run for. The default for most projects is 'Debug'.
  -f, --framework <FRAMEWORK>             The target framework to run for. The target framework must also be specified in the project file.
  -r, --runtime <RUNTIME_IDENTIFIER>      The target runtime to run for.
  --project <project>                     The path to the project file to run (defaults to the current directory if there is only one project).
  -p, --property <property>               Properties to be passed to MSBuild.
  -lp, --launch-profile <launch-profile>  The name of the launch profile (if any) to use when launching the application.
  --no-launch-profile                     Do not attempt to use launchSettings.json to configure the application.
  --no-build                              Do not build the project before running. Implies --no-restore.
  --interactive                           Allows the command to stop and wait for user input or action (for example to complete authentication).
  --no-restore                            Do not restore the project before building.
  --sc, --self-contained                  Publish the .NET runtime with your application so the runtime doesn't need to be installed on the target machine.
                                          The default is 'false.' However, when targeting .NET 7 or lower, the default is 'true' if a runtime identifier is specified.
  --no-self-contained                     Publish your application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run your application.
  -v, --verbosity <LEVEL>                 Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
  -a, --arch <ARCH>                       The target architecture.
  --os <OS>                               The target operating system.
  --disable-build-servers                 Force the command to ignore any persistent build servers.
  -?, -h, --help                          Show command line help.
@mrfelton mrfelton added enhancement New feature or request needs-triage This issue has yet to be looked over by a core team member labels Feb 26, 2024
@mrfelton
Copy link
Contributor Author

Note, is is actually possible if you define serve target like this:

        "serve": {
          "targetName": "serve",
          "dependsOn": [],
          "cache": false,
          "options": {
            "watch": false,
            "configuration": "Debug",
            "no-build": true
          },
          "configurations": {
            "production": {
              "configuration": "Release"
            }
          }
        }

Note addition of "no-build": true option. This actually passes through to the dotnet run command. But this is something of an undocumented hack as there is no no-build option documented, and if it were to be supported properly, the option should be noBuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage This issue has yet to be looked over by a core team member
Projects
None yet
Development

No branches or pull requests

1 participant