简体   繁体   中英

Reference manager is empty in vs 2017 .net core class library project

I'm trying to add reference to System.Configuration.dll assembly.
I'm using .Net framework Core, as it can be seen in my .csproj file:

<TargetFramework>netcoreapp2.2</TargetFramework>

(Output type of my project is set to Class Library .)

To do this, in solution explorer, I right-click on Dependencies of my project and then click on Add Reference... . Problem is that the opened Reference Manager is empty and there is no assembly I can add a reference to.

However, without referencing that assembly I'm able to write the following line without any build error:

using System.Configuration;

First Question: How is it possible that the above line gets successfully built, without me referencing that assembly?

If I try to use ConfigurationManager class to read data from app.config file (As told here ), I get an error complaining that:

CS0103  The name 'ConfigurationManager' does not exist in the current context

Question two: what can I do to solve that error? wha't wrong with my code or project?

My case is not the same as this question and this is not a duplicate of that question.

Add Reference is for your local references. You need to use Nuget Package Manager in order to include references.

most importantly .Net Core does not use .Net Framework packages where ConfigurationManager is .Net Framework package.

You need to use .Net Core or .Net Standard libraries with .Net Core

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM