Implement framework-dependent application with apphost.#2282
Implement framework-dependent application with apphost.#2282peterhuene merged 2 commits intodotnet:release/2.1.4xxfrom
Conversation
|
Marked WIP until https://github.com/dotnet/core-setup/issues/4169 is addressed. |
| <value>It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. Please either specify a RuntimeIdentifier or set SelfContained to false.</value> | ||
| </data> | ||
| <data name="CannotUseAppHostWithoutRuntimeIdentifier" xml:space="preserve"> | ||
| <value>The application host cannot be used without specifying a RuntimeIdentifier. Either specify a RuntimeIdentifier or set UseAppHost to false.</value> |
There was a problem hiding this comment.
Just a heads up: You'll need to assign error codes to these when you merge with my changes. Tests will fail to alert you to it as well.
There was a problem hiding this comment.
I'll review that PR and take the appropriate steps. Thanks for the heads up.
There was a problem hiding this comment.
The steps should be:
- Pick highest error code + 1 (tests will fail if you leave a gap)
- Add
NETSDK1234: to value like the others have now - Put StrBegin comment like the others too
- Update XLF as usual.
There shouldn't be any code changes needed, only resx + xlf are impacted.
|
@dotnet-bot test this please (I want to see if my newly added error code tests fail as expected) |
d6b085b to
1cd4e95
Compare
1cd4e95 to
87d8ca0
Compare
|
heads-up: this will require a follow-up change to the websdk's web.config transform targets: https://github.com/aspnet/websdk/blob/bbb651e4ce9ca7eb6308babdd698a2c00f4cc208/src/Publish/Microsoft.NET.Sdk.Publish.Targets/netstandard1.0/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets#L35-L58 |
|
@JunTaoLuo FYI on @dasMulli's comment about updates that will be needed in the web SDK to go along with this |
|
There is another target at the end of the file that predicates If the tasks used by these targets are determining whether or not to use |
|
@nguerrera I've updated the PR with the error codes. |
|
FYI, I think @vijayrkn would be more familiar with the affected areas in the web SDK. |
This is a bug. This target conditions should be same as the other target.
Yes, the tasks just needs to know if the web.config needs to be updated with "dotnet appname.dll" or "appname |
87d8ca0 to
110e791
Compare
|
@livarcocc approved to merge? The core-setup issue I linked above only affects running with the CWD as the directory containing the apphost. The test I added to run the apphost runs with CWD set to a different directory and points |
|
Did we run this through @KathleenDollard ? |
|
Sent a detailed email to Kathleen last night. |
@peterhuene @eerhardt Is there a reason to require explicitly setting |
|
@dsplaisted That's certainly an option, but it's a behavioral change. I can buy an argument that once your RID specific you might as well get the benefits of the app host, but logically these can be separate too. @eerhardt @steveharter Thoughts? |
|
Sorry, I misread Daniel's message. I can see the benefit of defaulting |
|
@peterhuene That's not what I meant. I agree that This is still a change in behavior, but I think it's probably more in line with user expectations. |
Given the amount of, let's say...impassioned, comments on dotnet/cli#6237, I think it would certainly align with user expectations. I'd like a similar experience with |
|
This looks good. Let me just confirm a few command line possibilities (you can infer the MSBuild) framework dependent (dll) self contained application (exe) framework dependent with host (exe) (not sure what we should call this) Did I leave out any possibilities? Is there anywhere else we have this kind of difference (nuanced) between MSBuild and |
|
Is there a spec that specifies As far as the command-line possibilities, I see several things I would change, but @peterhuene should probably chime in first as he's more familiar with the details. |
|
I'm fine with Let me comment on the above:
Without a runtime specified, this is considered to be a portable application and users can run it with any installed runtime via
This publishes as framework-dependent, but without a apphost (current behavior). See above for discussion for possibly making the default with apphost. It would then follow that we might need a
This causes an error from the SDK because you can't publish a self-contained application without the apphost. Users won't have a way of activating the application in a self-contained manner without the apphost.
This would be the same as
This publishes a self-contained application with the apphost (always with the apphost).
Same behavior as the above command.
This is the same error as described above. It doesn't make sense to create a self-contained deployment without an apphost.
This is currently a self-contained deployment and the --with-apphost has no effect (defaults to true for self-contained deployments).
This publishes a framework-dependent application with the apphost. |
|
For comparison: Go has a |
|
(sry for spamming). I think that |
|
I like the single option. I'd like to complete the table with I am not sure |
|
@dasMulli suggested |
|
+1 for |
This commit implements building and publishing a framework-dependent application with the application host. Building with `/p:UseAppHost=true` (when a `RuntimeIdentifier` is specified) and with `/p:SelfContained=false` will create an executable apphost that can be used to run the application against globally installed runtimes. Fixes dotnet#6237.
110e791 to
c4b2e48
Compare
|
Ping @nguerrera. I've pushed up changes to make Would you mind re-reviewing? Thanks! |
|
@peterhuene Do you have the SHA before the rebase so I can see the diff with what I reviewed last? Tried searching mail and failed, can you check reflog? FWIW, I prefer to hold off on rebasing until reviews are complete so that reviewers can see the iteration-to-iteration diffs easier. |
|
One more thing I hope GitHub eventually copies from VSTS :) The previous commit SHA was 1cd4e95. |
I didn't know VSTS had something better for this. Until then, consider using |
|
(I approved again of the latest changes in case the notification wasn't obvious.) |
|
Thanks, @nguerrera. @livarcocc approved to merge? |
|
I'm just a regular Joe moron trying to wrap my head around all this new-fangled core stuff, but my 2c is that "exe" is going to be confusing for people because they associate it deeply with Windows executables rather than being a cross-platform abbreviation. Instead, what about changing the parameters to be something a little more platform agnostic like "…-no-binary" or "…-no-bin"? BTW thanks for all the good work, we like the direction that things are moving and how receptive y'all are to user feedback! |
|
Also, will the RID argument be optional on any of the three modes? Again, please take pity on my noobness. |
|
You know now that I think about it, "binary" might be a bad colloquialism in this case. Maybe just spelling out "-executable"? For better or worse, the abbreviation "exe" has Windows associations. |
|
Hi @ericsampson. I would not oppose to spelling out Regarding the RID: the RID is required for using this feature. The SDK will error if it isn't provided. This is because we need to know which NuGet RID-specific package to copy the platform-specific apphost from. I think there's enough users that expect Oh and thanks for the "thanks" 😄 We ❤️ our users and community and realize our software and platforms wouldn't exist without them! |
| <data name="CannotUseAppHostWithoutRuntimeIdentifier" xml:space="preserve"> | ||
| <value>NETSDK1066: The application host cannot be used without specifying a RuntimeIdentifier. Either specify a RuntimeIdentifier or set UseAppHost to false.</value> | ||
| <data name="CannotPublishFrameworkDependentWithoutRuntimeIdentifier" xml:space="preserve"> | ||
| <value>NETSDK1066: It is not supported to publish a framework-dependent application without specifying a RuntimeIdentifier.</value> |
There was a problem hiding this comment.
Hmm, I'm very confused by this key name and message. You can publish a framework-dependent app without specifying a RID, you just can't get an exe for it without one. This is what happens out of the box with dotnet new mvc; dotnet publish and this is documented as a framework-dependent deployment.
There was a problem hiding this comment.
The problem with calling that "framework dependent" is that, while it is dependent on a shared framework being installed, it doesn't care which one. I personally think there should be a distinction between a "portable" (RID agnostic) deployment and a "framework-dependent" (RID-specific) deployment, but I don't call the shots.
So if we call dotnet publish without RID a framework-dependent deployment, then what should dotnet publish --mode fx-dependent do? Right now it tries to use the apphost which requires a RID and errors.
Without this change dotnet publish --mode fx-dependent-no-exe does not error, which is fine if we call out it's the default when a RID is not specified.
I'm ok with backing out this commit and having the option text explain that fx-dependent-no-exe is the default without a RID, self-contained is the default with a RID, and fx-dependent requires a RID to use.
There was a problem hiding this comment.
I think we should just make it so that you get an AppHost whenever you have a RID and don't when you don't. (We can allow /p:UseAppHost=false if you really want to be tied to a RID but not have the exe. This is current self-contained false, but the more I think about it, the more useless that case is so I don't think we need to have a nice CLI spelling for it.)
There was a problem hiding this comment.
Ok, I'll amend this commit to only change the error text to:
A RuntimeIdentifier must be specified to publish a framework-dependent application with an application host.
and this will only be displayed for dotnet publish --mode fx-dependent. We'll allow dotnet publish --mode fx-dependent-no-exe with or without RID (default for without). dotnet publish --help will explain things as needed.
There was a problem hiding this comment.
I'd like to consider iterating on this a bit more, but I don't want to block the checkin on it.
I personally think there should be a distinction between a "portable" (RID agnostic) deployment and a "framework-dependent" (RID-specific) deployment
We'd invalidate a lot of knowledge and docs if we say that "framework-dependent" as a general term means tied to particular OS and CPU. I don't call the shots either, it is something we can discuss with the broader team.
So if we call dotnet publish without RID a framework-dependent deployment, then what should dotnet publish --mode fx-dependent do?
I would be in favor of having it just produce a portable app without the apphost:
dotnet publish --mode fx-dependent --> portable framework-dependent app
dotnet publish --mode fx-dependent -r win10-x64 --> framework-dependent win10-x64 app
There was a problem hiding this comment.
Sorry, I pushed up without seeing your comments. I like that proposal, so let me make that happen on the CLI side.
There was a problem hiding this comment.
For my proposal, I think it only works if we drop the fx-dependent-no-exe mode. Might be worth talking it through some more with others. Feel free to iterate on this with a separate PR.
There was a problem hiding this comment.
I'll merge when green and we can further that discussion on the CLI side.
I've made a change to the CLI now whereby fx-dependent and fx-dependent-no-exe do the right thing without RID specified (effectively mean the same thing). With RID, the former produces the apphost and the latter does not. The error message I changed just now only results if you explicitly try to set UseAppHost to true without a RID specified.
51e4261 to
1583948
Compare
…tions. This commit improves the error message users experience when attempting to publish a framework-dependent application without specifying a runtime identifier. The new message better aligns with the message users receive when attempting to publish a self-contained application without specifying a runtime identifier.
1583948 to
8a3e03d
Compare
|
If there are any outstanding questions/concerns/comments regarding the |
This commit implements building and publishing a framework-dependent
application with the application host.
Building with
/p:UseAppHost=true(when aRuntimeIdentifieris specified)and with
/p:SelfContained=falsewill create an executable apphost that can beused to run the application against globally installed runtimes.
Fixes dotnet/cli#6237.