Skip to content

dotnet restore app.cs #48551

Closed

Description

@RikkiGibson

The vscode tooling appears to run a restore by digging up the SDK associated with the current project and running dotnet restore <project> in a subprocess. (I'll try to dig up the source code for this when I get a chance.)

So, the most expedient way for us to do restore in the editor, is likely going to be to support that command for file-based programs as well.

Possibly dotnet restore <project> is just an alias for dotnet build <project> -t:Restore, which would give us a straightforward workaround.

Activity

  1. ghost added
    untriaged
    on Apr 17, 2025
  2. RikkiGibson commented on Apr 17, 2025

    @RikkiGibson
    MemberAuthor

    @jjonescz for visibility

  3. added
    Area-run-file
    and removed
    untriaged
    on Apr 17, 2025
  4. jjonescz commented on Apr 22, 2025

    @jjonescz
    Member

    Note that currently dotnet build and dotnet restore forward all their arguments to msbuild.exe. Since we are building in memory using MSBuild APIs (and there is no API to convert from MSBuild command line args to some options we could pass to the APIs AFAIK), build/restore support for file-based programs will likely miss support for many MSBuild arguments (except for common ones like -property which dotnet run also supports).

    Although it looks like build/restore commands forward msbuild flags via their "SlnOrProjectArgument" (which gets all unrecognized arguments), so it looks like unofficial/undocumented/unintended behavior anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-run-file

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions