-
Notifications
You must be signed in to change notification settings - Fork 794
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
Adding Serilog to an existing project: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation #1215
Comments
:-) Hi Riza! Thanks for getting in touch. Unfortunately most of these kinds of issues end up being machine-specific, or caused by bugs/limitations/intended behavior in Visual Studio, NuGet or It's also usually hard to reproduce the exact setup that produces the error - so we don't generally try, unless an error is being reported widely. If you're able to dig in deeper, and figure out whether the problem is the Serilog package itself, or just something the SDK is doing incorrectly based on Serilog or one of its framework dependencies, the help would be appreciated. We're eager to fix any issues that can be addressed by Serilog directly, and will happily commit time to that if the cause is found. Hope this helps, and please keep us in the loop if you find additional information. Nick |
I had the same issue. I think it is still a Serilog related issue. Serilog is dependent on System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0. But current version for System.Runtime.InteropServices.RuntimeInformation, v4.3. So System.Runtime.InteropServices.RuntimeInformation, v4.0 is not available, so the program can't locate it. Serilog should update its package to using System.Runtime.InteropServices.RuntimeInformation, v4.3. |
Also, i do the same issure its very clear interesting with serilog!
Error: Could not load file or assembly 'Serilog.AspNetCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10'. The system cannot find the file specified. Explanation!: I have always installed lastest version, that is .net core 2 nowdays. Not difficult to reproduce the error. You can create a project with 2 layers with a standart library 2.0 and a webapi. That api will call to the lib project and will use serilog in one of them or both and than it will throw this error!!! |
Interesting @dewelloper did you resolve this? I currently ran into this adding it to an OLD ASP.NET 4.7.2 Web forms app. The web app doesn't use/reference serilog, but a dependent logging project does. The dependent project is .NetStandard 2.0. And I get:
.....which is not even the version that is installed (2.9). ...this could be why:
from the serilog 2.0 upgrade guide:
It seems to me that the versioning is goofed in my app, as it is supposed to be .Net Framework 4.7.2. For me I am using serilog successfully in many projects, mostly .Net Core, so I have created my own convenience nuget packages to roll it up with the sinks and modules I like. And I also use Serilog in at least one framework console app, which also contains a .NetStandard 2.0 library which also uses Serilog (the library has its own separate logging setup, to log separately). Again, no problems there. |
Hi @zachrybaker , If you reference netstandard project from old style csproj you won't get Serilog.dll in output (check the |
@zachrybaker i remember that I converted library version to caller project version. On my position it's appeared difficult but to making it simple than fixing library |
For me including all the dependencies AGAIN in the target Framework
project, not just the project that actually needed it at compile time, made
run time work. Lame and makes visual studio slow as dirt, but not
Serilog's fault.
…On Wed, Aug 19, 2020 at 1:55 PM dewelloper ***@***.***> wrote:
@zachrybaker <https://github.com/zachrybaker> i remember that I converted
library version to caller project version. On my position it's appeared
difficult but to making it simple than fixing library
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1215 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACDSMXLTG2FEVL3CLJV2QLSBQN3XANCNFSM4FUZWZ4Q>
.
|
Thank you so much for this, it made me realize I needed to add a post-build event that copied the serilog dll's to the actual directory my program runs. |
A few questions before you begin:
Does this issue relate to a new feature or an existing bug?
What version of Serilog is affected? Please list the related NuGet package.
<package id="Serilog" version="2.7.1" targetFramework="net471" /> <package id="Serilog.Sinks.Console" version="3.1.1" targetFramework="net471" /> <package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net471" />
What is the target framework and operating system? See target frameworks & net standard matrix.
OS: Windows 10
Please describe the current behavior?
When executing this line:
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll [09:26:05 INF] WebHost.CreateDefaultBuilder(): Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [09:26:05 INF] InnerException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Please describe the expected behavior?
Removing Serilog all together was fine. I assume this is because Serilog package was added.
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
This all works without any issue without Serilog. However, I would like to use Serilog rather than my built-in too simple logger. And this is cause an issue.
The text was updated successfully, but these errors were encountered: