serilog-sinks-file
serilog-sinks-file copied to clipboard
System.Runtime 5.0.0.0 dependency after updating to last version
Hi,
I have a .net 4.8 project (Windows Service) that depends on a .net standard 2.0 project with classes for log management through serilog.
It was working fine with version 4.1.0 but after updating to version 5.0.0, I started to get the following error when the log initialization is triggered: "Could not load file or assembly System.Runtime, Version=5.0.0.0"
Apparently the dependency reference is correct, it seems to look for .net 5 runtime when running.

Any help would be appreciated. Thanks in advance.
Thanks for the heads-up, that's rather strange!
The 5.0 netstandard2.0 version doesn't look to have any strange dependencies:

Just some ideas that might help narrow this down-
- Is the .NET Standard project in the same solution, or are you consuming it as a library?
- Is your project a new-style or old-style CSPROJ?
- Have you tried completely cleaning and rebuilding?
- Do you have .NET 5 installed at all? (Not sure how this would/should impact it .. but .. >???)
- Do you know which MSBuild binary you're building with?
- Does it work if you build using
dotnet buildinstead of VS?
Hi,
Thanks for the hints. Checked all and seems to be ok. When activating build verbose output, found this message which seems to be the cause. But didn't find out why the 5.0.0.0 version is required.
8> MSB3243: No way to resolve conflict between "System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily. (TaskId:25) 8> References which depend on "System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. 8> C:\prjNet\CSU\ADD-ON\Master Data\Implementação\Output\Platform\Serilog.Sinks.File.dll 8> Project file item includes which caused reference "C:\prjNet\CSU\ADD-ON\Master Data\Implementação\Output\Platform*Serilog.Sinks.File.dll".*
The .net assembly (.net standard) where this package is used, is also shared with .net 5 projects, besides the .net 4.8 project is. But can't find out what is the problem, since it was working fine with previous version.
Still looking...
Looking at #232, any chance adding the below to your CSPROJ fixes it?
<PackageReference Include="Microsoft.NETCore.Targets" Version="5.0.0" PrivateAssets="all" />
Same issue here. Cannot update to 5.0.0.
Hi, I'm spring cleaning the issues lsit. I feel this issue is just confusing, so ideally we'd shift it to either a) closed or b) a clear problem definition (ideally with a documented workaround)
I suspect there likely is a workaround given the lack of traffic on this issue atm
@juanmalm have you found a solution? @ruipaulomonteiro did you try Nicks's suggestion?
@juanmalm have you found a solution?
Nope
Could not explain why but I rebuilt all from scratch and started working. Thanks!
Thanks @ruipaulomonteiro for circling back (and closing - hopefully the 11 remaining issues now correctly represent the actionable enhancements and/or investigations that this repo is the right place for...)
@juanmalm if you're still blocked, I'd suggest trying Nick's suggestion, and then creating a stack overflow question tagged serilog documenting:
- what you tried (with relevant snippets of csproj files, build outputs etc)
- the exact issue/message on which you are blocked and posting a link to it here.