-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Two self-contained apps targetting different runtimes #46990
Comments
Tagging subscribers to this area: @vitek-karas, @agocke Issue DetailsI have a self-contained app (App1) targeting .NET 5.0.1 which is packed alongside another self-contained app (AppFull) targeting .NET 5.0.2. I was expecting everything to work well, but I get several errors with wrong .dll versions when running AppFull (which uses App1):
Runtimeconfig.json of App1
Runtimeconfig of AppFull
And looking at the I also tried what's suggested in Framework version resolution but it doesn't seem to work. What's the best way to solve this problem? I was trying to avoid modifying App1.deps.json manually
|
Could you please clarify what you mean by "pack alongside"? Also the runtime configs above are for framework dependent apps, not for self-contained apps... (not that it matters for the versions). Which part of the Framework version resolution document did you try to use (there's lot of stuff in that topic). |
Thanks for the answer!
Yes, that's basically it. I copy the contents of App1 into AppFull. Is there any better way of achieving this?
I tried the rollForward option in |
You state that the |
In short this is currently an unsupported scenario - the story is basically: whatever SDK produces, should work, if you make changes to the output of SDK it might break. For most assemblies and files this will work because the file names didn't change and the It should mostly work if you make sure both apps are published with the exact same framework version. You will still have to deal with any versioning issues between NuGets and other dependencies of the two apps though. Note that some other features will become next to impossible to get working - for example |
So, in this scenario, do you know any other approach better than mine (i.e. copy one self-contained app to the contents of other) ? Thanks for the info so far |
You might be able to get something slightly better if there's a project reference between the two apps. As per this PR dotnet/sdk#14488 SDK might be able to handle at least some situations. |
👍 One final doubt. I noticed that running AppFull in Windows results in the errors referred above but running that same AppFull in Mac does not. Any idea on why? |
I honestly don't know, there only seems to be |
The names of the debugger support modules (DAC,DBI) are Windows: both mscordaccore.dll/mscordbi.dll and modules like mscordaccore_amd64_amd64_5.0.120.57516, Linux: libmscordaccore.so/libmscordbi.so, MacOS: libmscordaccore.dylib, libmscorlib.dylib. The DAC modules mscordaccore_amd64_amd64_5.0.120.57516 are basically that runtime's version of mscordaccore.dll but decorated with the "host" architecture, "target" architecture and runtime version. This naming allows the Windows debuggers to download cross-architecture DACs (i.e. download the arm64 target DAC that runs on x64). I don't know all the ins and outs of self-contained apps, but I assume they built for and target specific OSes and architectures. If "AppFull" is only built for "win-x64" and it is run on "MacOS" you may see problems like this. |
@mikem8361 No, AppFull and App1 were built for both "win-x64" and "osx-x64". Ultimately we were following a Single-File publish approach of App1 to solve the problem, and while debugging everything seemed solved. However, because of #3671 we cannot sign the App1 bundle and hence this isn't a workaround as well. New ideas are welcome. |
@Jmales Why do you want to put both apps in the same directory? It's not clear to me what problem you're trying to solve. |
@agocke initially we wanted to put both on the same directory since they both use some shared .dylib/.dll. We were trying to save some space. However, that was a problem due to the 2 We gave up on trying to save space and we invested some time in having App1 published as a Single-file inside AppFull. That solved our problem, however the signing process in Mac was a blocker. Ultimately (today) we ended up having a self-contained App1 inside a sub-directory of AppFull which seems to do it. We have a lot of repeated .dlls/.dylibs but that seems to be the only method that works at the moment. |
This is super annoying because the mscordaccore_amd64_amd64_* dll is literally the only dll in the published output that has a version number on it. And because the file name can vary depending on which machine it was built on it breaks other processes, like building installers and nuget packages that rely on a static list of file names. Running the app without that file doesn't seem to be an option so is there another solution? It would be a real hack to have to write a script to change the file name and the reference in deps.json. |
If the two apps are not built against the same exact version, there's absolutely no guarantee that when you copy them over each other it will work anyway. So the version mismatch is in a way a good thing. In short, this is not a scenario which is currently supported and so it's not expected to work. What is supported is sharing a private runtime between the apps, but sometimes this is not very friendly (the functionality to make it friendly is currently missing): #52974 (comment) |
It sounds like the problem is that the "long" named DAC is referenced in *deps.json. It doesn't need to be. It is used by SOS/debuggers and not directly by the runtime itself. It may not even need to be part of the self-contained app since those SOS/debugger can usually (even for private or nightly builds) download it for a specific runtime version. |
Even if the file is removed, this is not a supported scenario. There's quite a bit of logic in nuget reference resolution that gets stomped over by this. In this method of munging folders together you'd need a way to only copy the highest assembly version and such. The roll-forward is not guaranteed to work for example, but it most likely will work. The problem is with references to DLLs in packages and the transitive closure resolution. |
Closing in favor of #53834 |
I have a self-contained app (App1) targeting .NET 5.0.1 which is packed alongside another self-contained app (AppFull) targeting .NET 5.0.2. I was expecting everything to work well, but I get several errors with wrong .dll versions when running AppFull (which uses App1):
Runtimeconfig.json of App1
Runtimeconfig of AppFull
And looking at the
deps.json
files I can see that the system versions are different. App1 hasfileVersion
5.0.120.57516 forMicrosoft.CSharp.dll
, while AppFull has fileVersion5.0.220.61120
which seems to me that it's the root cause of my problem.I also tried what's suggested in Framework version resolution but it doesn't seem to work.
What's the best way to solve this problem? I was trying to avoid modifying App1.deps.json manually
The text was updated successfully, but these errors were encountered: