Need to support additional restore options when restoring for a RID in self-contained publish
See original GitHub issueSee https://github.com/dotnet/cli/pull/4286#pullrequestreview-2420079
When we are calling dotnet restore3
when publishing for a self-contained app, we are not passing in any extra options to restore3
. This can be an issue for users who call restore with specific properties. When we call restore, it will be overwriting the project assets file that was originally restored.
Some options for supporting this:
- Pass
ExtraMSBuildArguments
into both the restore call and the publish call.- This can have issues if you explicitly need different values for the two MSBuild calls.
- Come up with another way to take both “extra restore args” and “extra publish args” separately in one command-line.
- The user can use environment variables to set any properties they want passed into MSBuild /t:restore.
- Save the arguments passed into
dotnet restore3
orginally, and read them during publish’s call to restore. - The user explicitly restores with the RID + extra restore options before calling publish. Then we add a new option to
dotnet publish3
:--no-restore
, which allows publish to use the previously restored assets file, with the RID in it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Need to support additional restore ...
The user explicitly restores with the RID + extra restore options before calling publish. Then we add a new option to dotnet publish3...
Read more >dotnet publish command - .NET CLI
To disable implicit restore, use the --no-restore option. The dotnet restore command is still useful in certain scenarios where explicitly ...
Read more >How do I explicitly make sure my restore, build and publish ...
I'm guessing I can be more explicit in my CLI commands but I'm not sure how and what to be explicit about. To...
Read more >Avoiding Midairs - Jun 2002 - Page 51 - Google Books Result
More importantly, it takes the anxiety out of learning to fly, ... each major training option and assists you in deciding which best...
Read more >.NET SDK Support
Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, no it can’t. This is because “restore” will install .props and .targets files into your project. But if restore happens in the same MSBuild invocation as ‘publish’, those new .props and .targets files will not be honored/loaded/used. In order to get the correct behavior, you always need to restore in a separate MSBuild invocation than when running targets that can be affected by restore.
Thanks for pointing this out. @emgarten has fixed it so the Restore target would also honor
/p:RuntimeIdentifier
. See https://github.com/NuGet/NuGet.Client/pull/927.@eerhardt thanks for the more detailed explanation. Based on the above, I see that P2P references and restoring them for a given RID was the major reason this backing out was done?
While it is true that not having
type: platform
is more towards the goal we wanted, this solution still requires changing your project. With this in mind, we cannot really say that our goal has been met.