-
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
If PublishSingleFile=true is set in the project file it changes the behavior of dotnet build and similar #29795
Comments
@VSadov @elinor-fung @sbomer - FYI. Specifically the single-file host issue is something we should definitely look into. |
This is likely one of the reasons why |
Maybe fixed by #29031? I have a recent 8.0 installed and didn't see the building as self-contained behaviour.
Wow. Looking at the code, it is working (ish?) because the bundle marker/placeholder doesn't get updated - |
Apparently we explicitly check that you can use I can't think of the scenario for this behaviour (aside from this issue - where @VSadov @vitek-karas do either of you know if there is an scenario for this / why we seem have some attempt at enabling it? |
I think this is just history. The test was added when we first build a "static host" which was just apphost with hostfxr and parts of hostpolicy linked in. dotnet/runtime#36230. Since such a host did not have the runtime in it, it made sense to allow it to load the runtime from disk - we basically had to anyway since single-file back then simply unpacked the runtime to disk. Later on we switch to superhost and this behavior makes little sense anymore... |
We changed a bunch of the default self-contained behavior in 8. Is this still an issue needing investigation? (@vitek-karas @agocke @elinor-fung @dsplaisted ) |
This is still an issue. The changes to default self-contained made it a bit less egregious (since just setting |
Maybe a bigger change (for 9 only) would be to decouple apphost creation for build from single-file apphost creation. Basically the "publish single file" step would start over with the executable. Completely independent of the build stuff. Although I don't know how complex it will be to wire it up with restore (since we need to download the right singlefile host). |
This is the only option I could think of at this point. Just trying to detect build vs. publish when choosing the apphost (which was my initial thought) wouldn't be enough, since the publishing for single-file just assumes that an apphost has already been created (stamped with the app assembly) in an intermediate location as part of build - then just takes that and bundles files into it. Restore: I think currently restore still needs to happen (explicitly or default where build/restore happens as part of publish) for publish to work correctly (single-file or regular apphost). So maybe there wouldn't be extra wiring needed. |
Setting
PublishSingleFile=true
in the project file has implication on howdotnet build
anddotnet run
operates which are unexpected.It will:
PublishSingleFile=true
- the effect of this is that the output is in a different location (the output directory has the RID subdirectory appended to it)dotnet build
output, but without appending anything to it. Honestly it's surprising this even works at all. It's definitely not intended as the right behavior.I assume some of this is related to the "RID defaulting" behavior introduced in 7.0, but it's questionable if it's a good behavior or not.
The single-file host is just a bug - we should NOT be doing that under any circumstances.
Note that this has effect on
dotnet run
which will use the wrong host to run the app. It seems to mostly work, but it's unclear if there are corner cases where it will break.The text was updated successfully, but these errors were encountered: