none
How to Add Reference in Visual Studio 2015?

    Question

  • I can't seem to Add Reference like I used to in previous versions of Visual Studio.

    I want to use the System.Configuration.ConfigurationManager class in a MVC web project targeted at 4.6. 

    I went through the usual Add Reference, but there are only System.configuration 4.0.0.0 or System.Configuration 1.0.0.0.  Adding either does not allow me to compile as the compiler still says that "The type of namespace name 'Configuration' does not exist in the namespace 'System' (are you missing an assembly reference?)".  However, Intellisense does pop up the various class properties and methods after I have added either one of these.

    Has the method of adding references been changed?



    • Edited by K.Kong Sunday, December 20, 2015 12:07 AM
    Saturday, December 19, 2015 2:17 PM

All replies

  • What project type?

    I just added System.Configuration as a reference in a C# Winforms project by right-clicking on References in the Solution Explorer window, then selecting Add Reference...

    I am then able to reference

    System.Configuration.ConfigurationManager

    in code.

    I'm using VS 2015 CE.

    What happens when you do the above?

    Saturday, December 19, 2015 5:04 PM
  • have you correctly set the target .NET Framework in project property ?


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Saturday, December 19, 2015 7:47 PM
  • have you correctly set the target .NET Framework in project property ?


    Initially, when I created the project I selected 4.6.  But now, going to Project Properties, I don't see that selection anymore.  The Application tab just have Configuration: N/A, Platform: N/A, both grayed out, Default namespace:, Solution DNX SDK version: 1.0.0-rc1-update1, Web root: wwwroot.  That is all.

    Have I done something wrong?

    Sunday, December 20, 2015 12:05 AM
  • Hi K.Kong,

    I create a default MVC web application with Visual Studio Enterprise 2015 with Update 1, the System.Configuration dll has been referenced for default. And when I input ConfigurationManager class in my class, it shows correctly.

    Please check whether you have installed Web Developer Tools for your Visual Studio 2015. If not, please install it from Control Panel -> Programs -> Visual Studio 2015 -> Change -> Modify.

    In addition, System.Configuration is belong to .NET Framework 4.5 and 4.6. Please try with following steps to check whether the .NET Framework installed on your computer has corrupted.

    1. Run “SFC /scannow” to repair the embed .NET first, refer to:  https://support.microsoft.com/en-us/kb/929833
    2. Use .NET Framework Setup Verification Tool to verify the .NET Frameworks on your machine, you can download from here: http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx

    By using it, you will find the log file under %TEMP% folder, see the first 15 lines and the last 15 lines.

    If the exit code != 0, it means that your .NET installation incorrectly, please first use .NET Framework Repair Tool to repair it, http://www.microsoft.com/en-us/download/details.aspx?id=30135

    Best Regards,
    Weiwei

    Tuesday, December 22, 2015 6:19 AM
    Moderator
  • I uninstalled and reinstalled VS 2015 Community Edition version 14.0.24720.00 Update 1.  Still no joy.  All the .NET verification checked out correctly.

    There is a System.configuration 4.0.0.0 (note lower case 'c') under Add References.  Now there is no more System.Configuration 1.0.0.0. 

    There must be something fundamentally wrong and I don't know what it is. I never had any issues with the previous 10 versions of Visual Studio.

    Thursday, December 24, 2015 3:09 PM
  • Hi K.Kong,

    I change another computer which installed VS2015 Community version 14.0.24720 Update 1 and do the same operations, the result still the same.

    Please check the path of "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6", whether the System.Configuration.dll listed in this path.

    Then in order to exclude the effect of computer environment, please change another computer to check whether it also has the same problem.

    In addition, please use http://aka.ms/vscollect  to gather the VS and .Net Frameowrk installation logs. After using it, you will find vslogs.cab from %temp% folder. Please upload the file to Onedrive and share the link here.


    Best Regards,
    Weiwei


    Friday, December 25, 2015 3:17 AM
    Moderator