System.Private.ServiceModel not found
I've been using a library for opcua and haven't had any problems until now, didn't change anything in dependencies, but suddenly, I get the error during runtime that the System.Private.ServiceModel is not found. When I add a reference to the exact same version as the one that the error message is indicating, it is telling me that there is a conflict:
I honestly have no idea what the problem is, I've had a similiar problem before with System.IO.Ports, but that somehow dissapeared at some point.
When I do a clean build without the reference to System.Private.ServiceModel, I also don't get the dll in the output directory, despite it being referenced by the other package, and if I look at older releases, the dll was always present.
This has been bugging me for a whole day and the only workaround is to manually copy the dll or add the dll to the project (which in my opinion is ugly as hell)
Hope somebody might know what the problem could be. Thanks in advance.
53 Replies
is this the full error? i think there is supposed to be more text
The only additional thing after is the project files that cause it, basically the same line as MyProject -> ... but with the .csproj suffix
the error does not make sense. it does not show what is downgrading System.Private.ServiceModel to 4.5.1
it is uspposed to show the two different paths to System.Private.ServiceModel that resolve to different versions
Ah, yeah, sorry my bad, didn't see the difference in there
System.Private.ServiceModel (>= 4.5.0.3)it seems like you meant to write 4.5.3 not 4.5.0.3 yes, the assembly version might be 4.5.0.3. but what matters here is the package version, not the assembly version the package 4.5.3 contains the assembly version 4.5.0.3. they are different for reasons
okay, then at least that is resolved, but the question remains, why I need to add the reference in the first place, since the library has it as dependency
i don't know
Okay, I added it as reference with Version 4.5.3, but I still don't get the dll in the output
it shows up in my output when i reference Opc.UaFx.Advanced
under runtimes/
same for me, but not in the root output directory, which seems to be required?
Still get the error unless I copy it manually to the same path as the executable
do you not have a ProjectA.deps.json file in your build output
I do have that dependency file and it contains the Dependency
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
I think that would be too much work to pseudonymize all the names while still keeping it functional^^
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
i am certainly able to load it prints out
System.Private.ServiceModel
among other thingsUnknown User•8mo ago
Message Not Public
Sign In & Join Server To View
yes, it works fine
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
what is the call stack when you hit this file not found error
Ah, sorry, this was the ProjectA.Shared, this is the projectA.csproj:
Ah, is just replaced the sensitive stuff with bullshit and let chatgpt make it pretty, guess it replaced opcua as well. AdvancedLibrary is opc.uafx.advanced
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
the restore error has been fixed
but there is still a file not found error at runtime
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
I'll try to see if i can get a stacktrace
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Not my decision sadly, company uses that and would probably break shit it we updated to a newer version
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Honestly, I'm still pretty new to C# in general, never had the time to really understand all the ins and outs, since I had to jump straight into the project...
Stack Trace seems to be pretty empty...
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
yeah, mostly external code it seems
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
yes, the external code is what matters here
ok. well, nothing seems suspicious there
it is possible to debug this further but i think it will be easier to try this:
delete the reference to System.Private.ServiceModel
instead, add a reference to
the newer version of the package is put together in a less unconventional way, so whatever is causing this issue might not have a chance to do the wrong thing
Thanks a lot for the help! Will try that now...
Still the same error
that System.Private.ServiceModel is not found?
that does not make sense. it does not exist with the 6.0.0 version of the package
It still seems to be part of the dependencies in the deps.json, I deleted the build folder, output folder, did a clean and a clean build, still seems to appear in the deps.json
it is definitely not part of mine. the word private doesn't show up anywhere
<BaseOutputPath>..\..\..\bin</BaseOutputPath>
just to be clear, the two build outputs do not go into the same folder, rightthey do go to the same folder
._.
that is entirely wrong
tht should never be done
it would explain these inexplicable issues, because it just means one build will randomly overwrite the other based on which one happens first
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
at the very least, it needs to be explained what it's for...
honestly, i think nobdody really had any idea what they were doing. I just recently started working at the company and it's honestly baffling, even my private projects have better structure, testing, etc.
But since I'm still pretty new to c#, .net, msbuild etc, I'm not really in for improving things, just wanna finish the current project and then maybe/hopefully have some time for general improvements.
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
i guess, i just don't understand how this part is possible
here is my project:
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
and here is the only reference to System.ServiceModel in my deps.json:
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
do you have
System.ServiceModel.Primitives/6.0.0
? if you do not have System.ServiceModel.Primitives/6.0.0
, and you are sure you added the right package reference, then are you sure you are looking at the right deps.json file?Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View