Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

FileNotFoundException for System.Configuration.ConfigurationManager when referenced from .Net Standard library #279

Closed
ryno1234 opened this issue Feb 20, 2019 · 3 comments
Labels

Comments

@ryno1234
Copy link

We have a .Net Standard library which we created that references Raven v2.4.0. We call this our "Error Tracking" library - it essentially wraps Raven.

When we create a .Net Framework application that references our "Error Tracking" library (again, which is .Net Standard), we get an exception anytime we attempt to access Raven:

Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

The assembly System.Configuration.ConfigurationManager.dll is NOT in the bin directory of the main .Net Framework application after compilation.

I've brought this issue up (more generically) here: dotnet/standard#506 (comment)
but the answers provided do not fix the issue.

Any insight would be appreciated. At this point, our .Net Standard error tracking library is not usable as a reference in a .Net Framework application.

@bruno-garcia
Copy link
Member

Since your app is .NET Framework and so is Raven (multi targets), I'd suggest turning your Error tracking library into .NET Framework (or at least multi target).
There are many issues related to dependency resolutions when .NET Framework apps depend on .NET Standard libraries that microsoft finally advises everyone to always include a .NET Framework target if consumer is expected to be .NET Framework.

Ou new .NET SDK already multi targets (.NET Standard 2.0 and .NET Framework 4.6.1). Please consider moving to the new NuGet Package instead.

@ryno1234
Copy link
Author

Thanks @bruno-garcia. Do you have a link to to Microsoft's comment about this so I can read up on it?

Also, I think it would be beneficial to other's to know that they cannot simply build a .Net Standard library that uses Raven without multi-targeting. Perhaps something about this can be added to the docs.

@bruno-garcia
Copy link
Member

I'll point to you this: getsentry/sentry-dotnet#135 (comment) which will add some context from Sentry side and further into Microsoft.

Doing netfx -> ns -> netfx might work. But it might give you a headache. We tried avoid the multi targeting here until customers started hitting problems. The link above has some details.
I hope it helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants