-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cannot use file stream for [*.deps.json]: No such file or directory #64606
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsDescriptionWhy is a published app with
Still trying to locate the "*.deps.json" ? Who do I turn this warning off ? Reproduction Stepsdotnet publish -c Release -r linux-x64 --self-contained
Expected behaviorRunning with out warning about "*.deps.json" Actual behaviorCannot use file stream for [*.deps.json]: No such file or directory Regression?No Known WorkaroundsCreate the "*.deps.json" ConfigurationNo response Other informationNo response
|
I don't think there's a way to turn it off. It's a simple bug, the host should not write this out. Just curious: Why do you remove the configuration files. Especially the |
I do not understand the reason for these files. It is all encoded in the platform exe file, what dependencies is needed. And the DLL files also contains references to needed files. On Unix/Linux all files have a place, like "/usr/bin" and "/usr/lib", they are not just placed in a "C:\Program Files\name" folder. So want to keep the disk clean and not have unnecessary files around. Is it really the meaning that for all "exe" files in "/usr/bin/" there should be a ".runtimeconfig.json" and a ".deps.json". That makes no sense. I'm not sure where I found the configs. Could the bug be fixed ? |
I know that most apps is in containers or otherwise contained, so it really do not matter if these files are they. But I do not understand why it is not just encoded in the binary files. Which I believe it is when using "dotnet publish" |
You can create a single executable which "bundles" everything: https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file And yes - |
Yes, but I have 20+ server jobs, and don't want to embed all dependencies in all server jobs. |
Do I understand it correctly that you:
You could selectively exclude assemblies from the bundle: https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file#exclude-files-from-being-embedded |
I have made a "Server.sln" including the server jobs. Then I just do
I solve conflicts in dependencies, by not using NuGet and have made all dependencies as "RPM" packages, so I'm certain, that a new dependency is not pulled in. And I control the versions of the packages. (I'm not a fan of NuGet for large projects) I should properly use "--no-self-contained" and then just install the "dotnet" in the container image. But then "*.runtimeconfig.json" is required, and I find that stupid. (But then again when it is inside a container it do not matter much). |
Thanks for the description of the scenario. It's technically possible to publish a single-file where all assemblies are excluded, which would basically produce the exe with the config files bundled and nothing else. But it would have to be published as We've been thinking about using basically the above technique to "hide" the config files, so it's good to know that there's interest in it. |
It would be great to have a option to create a single "exe" (on Unix without .exe) file where the corresponding ".dll", ".runtimeconfig.json", "*.deps.json" was combined (excluding all other assemblies). That would make i more suitable on Unix, so it could be placed in "/usr/bin". Not sure if now you can put the "exe" file in "/usr/bin" and the "dll" file in "/usr/lib" and make it work. What is the idea behind having both an exe and dll file, and not a combined file ? |
The |
We do have an option for creating single file apps as well. It just isn't a default behavior. |
@richlander The feature ask here is basically "Framework dependent single-file with shared libraries". It's sort of possible with a little bit of hacking, but it's definitely not easy. |
From https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file |
@wzchua yes, that already works, but it will bundle all application assemblies. My understanding of the above is that the ask is to have a way to share some assemblies between the multiple apps. That is currently doable, but only through sort of hacks -> |
Yes I need away to use "ExcludeFromSingleFile" for all "ProjectReference" and "Reference", is there a way to do that ? |
@vitek-karas Yes, saying that it would be super great without hacks would be an understatement from me. I'm also in a similar situation where I need to deploy multiple executables (lots of small console based tools) that all depend on a set of shared libraries. Regarding *.runtimeconfig.json, in my opinion, ideally the But the above workaround hits another problem: NuGet package references. There are situations where I cannot create a framework-dependent deployment because I just cannot enforce the client to do a system wide install of the .NET framework. In this situation, the message Cannot use file stream for [...]: No such file or directory is especially annoying for console programs. In these particular use case, where I need a framework-independent deploy (with all required native and managed libraries in the same directory as the executables), I had to do an ultra-ugly dirty little hack by patching |
The idea of embedding the config files ( The idea to be able to exclude entire packages from single-file makes sense. Please create an issue just for that in the dotnet/sdk repo. Re excluding everything - it should be possible (didn't try this, but I know we did something similar for trimming for example) to add a custom target into your build which will automatically apply the #69314 should fix the writing to stderr. |
Thank you @vitek-karas, for the fix, for the hints and for the hope. |
Description
Why is a published app with
Still trying to locate the "*.deps.json" ?
How do I turn this warning off ?
Reproduction Steps
dotnet publish -c Release -r linux-x64 --self-contained
a exe file with:
Expected behavior
Running with out warning about "*.deps.json"
Actual behavior
Cannot use file stream for [*.deps.json]: No such file or directory
Regression?
No
Known Workarounds
Create the "*.deps.json"
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: