Click here to Skip to main content
16,022,352 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I got stuck while working with a project. I have a VB.NET front end windows app assembly and I implemented all business logic in a c# class library. Now I want to read the configuration file (app.config) of VB.NET assembly from C# Class library.

I reviewed lot of site on the Internet and most of the people recommended using ConfigurationManager class. But when I try to use it I can get that item in the intellisense. Am I missing something? I have imported System.Configuration namespace as well.

This is what I have in my App.config of VB.NET assembly.
XML
<connectionstrings>  
    <add name="Dev" connectionstring="Data Source=(local);Initial Catalog=SMS;User Id=sa;Password=****;" providerName="System.Data.SqlClient" />
</connectionstrings>

Please help me on how to read this connection string from my C# assembly.

Many thanks in advance.
Posted
v2

1 solution

You need to have the .Net 3.0+ version of System.Configuration to be able to see the ConfigurationManager. Make sure that is the version you are referencing.

If you still don't see it, type in System.ConfigurationManager anyway and see if you get the smart tooltip. Sometimes it will tell you that you need to import another namespace, for example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900