从同一解决方案中的C#类库程序集中读取VB.NET程序集的app.config - Reg。 [英] Reading an app.config of VB.NET assembly from a C# class library assembly in the same solution - Reg.

查看:44
本文介绍了从同一解决方案中的C#类库程序集中读取VB.NET程序集的app.config - Reg。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我在处理项目时遇到困难。我有一个VB.NET前端Windows应用程序集,我在c#类库中实现了所有业务逻辑。现在我想从C#类库中读取VB.NET程序集的配置文件(app.config)。



我在互联网上查看了大量的网站人们建议使用ConfigurationManager类。但是当我尝试使用它时,我可以在intellisense中获得该项目。我错过了什么吗?我也导入了System.Configuration命名空间。



这就是我在VB.NET程序集的App.config中所拥有的。

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.

<connectionstrings>  
    <add name="Dev" connectionstring="Data Source=(local);Initial Catalog=SMS;User Id=sa;Password=****;" providerName="System.Data.SqlClient" />
</connectionstrings>



请帮我看看如何阅读此连接来自我的C#程序集的字符串。



非常感谢提前。


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

Many thanks in advance.

推荐答案

你需要拥有。 Net 3.0+版本的System.Configuration能够看到ConfigurationManager。确保这是你引用的版本。



如果你仍然没有看到它,请输入System.ConfigurationManager,看看你是否得到了智能工具提示。有时它会告诉您需要导入另一个命名空间,例如。
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.


这篇关于从同一解决方案中的C#类库程序集中读取VB.NET程序集的app.config - Reg。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆