You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Activity
RikkiGibson commentedon Apr 17, 2025
@jjonescz for visibility
jjonescz commentedon Apr 22, 2025
Note that currently
dotnet buildanddotnet restoreforward all their arguments tomsbuild.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-propertywhichdotnet runalso 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.