-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable publishing for a RID with PublishRuntimeIdentifier
#26444
Comments
It would be nice if this includes a way for an SDK (the iOS SDK on our case) to set a default PublishRuntimeIdentifier. This is what happens right now:
|
That is a good idea. I never thought about that kind of option. Can you open a separate issue for that? |
Done: #27253 |
I assume we want I wish there was a better way to safeguard / prevent users from putting themselves into these messy situations with conflicting properties, but probably more of a hassle if we fail on these cases |
Command line args should always win. |
Thanks, that is a helpful rule to live by. Makes sense! One scenario that's kind of funky is |
Yeah that is kinda funky just due to what those parameters map to and this specific action (publish). However, it should be totally reasonable to have |
Closing this as resolved by: #28717. Thanks for the help and lmk if you have any issues with this! |
Enable publishing for a RID with
PublishRuntimeIdentifier
.NET is simultaneously cross-platform and good at targeting a single platform. Arguably, its cross-platform nature has the greatest benefit during development, where teams might span multiple operating systems and architectures. This nature also works well for deployment but building an app for a specific target often yields the best results. The gestures required to support the model of cross-platform development and single-platform deployment are OK but could be improved . We can fix that by adding a
PublishRuntimeIdentifier
property.We've been progressively adding
Publish*
properties over the last several .NET versions. They are a nice pattern since they are only effective for the publish task. It makes to extending that to Runtime Identifier (RID) targeting.Desired UX
Today, you have two basic choices (using Linux x64 as an example):
<RuntimeIdentifier>linux-x64<RuntimeIdentifier>
, matching the deployment target.-r win-x64
(assuming they are on Windows x64) to all of their CLI operations.-r linux-x64
withdotnet publish
commands when preparing a production deployment.Going forward, we can offer a new property that splits the difference between the current options, which is
PublishRuntimeIdentifier
.It will have the following characteristics, assuming
PublishRuntimeIdentifier=linux-x64
dotnet build
and related verbs (run
andtest
) are unaffected.dotnet run
will use the native Arm64 runtime on macOS by default. This assumes that the app is cross-platform (like a typical ASP.NET Core app).dotnet publish
will produce alinux-x64
by default, with the intention of producing an app for deployment.A common pattern with containers is:
dotnet restore dotnet publish -r linux-x64 --self-contained false --no-restore
That's similar to the intended behavior of
PublishRuntimeIdentifier
(ignoring SCD vs FDD). Ideally, the initial restore would download thelinux-x64
apphost, since we're about to need it. Perhaps that doesn't matter (or isn't how it works).Related context
I've been thinking about how to better differentiate
build
andpublish
. We need to ensure that we're seeing the full picture on what controls developers should have for the best local dev and production outcomes. In particular, we should think about which MSBuild configuration makes sense to specify differently viapublish
. PerhapsPublishRuntimeIdentifier
andPublishRelease
are the last remaining publish-specific gestures. Likely, we'll see something else that should be enabled in a similar way. My point is that we need to continue to think in these terms to ensure that we have good differentiation between thebuild
andpublish
experiences.I recently saw this Azure SDK sample. This (presumably) Azure-oriented property caused me some concern. I didn't look at the definition of it, but it's hard to imagine how it could be doing anything coherent. It's, in part, my inspiration for this scheme.
The text was updated successfully, but these errors were encountered: