473,809 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I have different name for Config File in visual studio?

1 New Member
I have a simple console app, there i have included a app.config file which is like below -

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.   <appSettings>
  4.  
  5.     <add key="x" value="member"/>
  6.     <add key="y" value="srmember"/>
  7.     <add key="z" value="srmember"/>
  8.   </appSettings>
  9. </configuration>
the file name was app.config once it included and in my class i was getting the correct value for the below code -
Expand|Select|Wrap|Line Numbers
  1. int no = System.Configuration.ConfigurationManager.AppSettings.Count;  [no=3]
  2.  
  3. but later I have changed the config file name from App.config to MyApp.config and the value for no got changed from 3 to 0.
  4. I have gone through the example present here like below -
  5. ExeConfigurationFileMap map = new ExeConfigurationFileMap();
  6.             map.ExeConfigFilename = "C:\Users\abc...\MyApp.config";
  7.             Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
  8.               int no = System.Configuration.ConfigurationManager.AppSettings.Count;
  9.  
which doesn't help to solve. Please help.
Feb 16 '12 #1
0 1193

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1616
by: Veerle | last post by:
Hi, I have 5 files open in Visual Studio .NET. When I try to close the second file, Visual Studio closes too. When I reopen Visual Studio and then try to close the second file, Visual studio again closes. I can close the other files without any problems. So what I wanted to do is find where Visual Studio saves which files you have open in a certain project. This allows me to modify this file/part of the registry/???, but I can't find...
3
3167
by: baylor | last post by:
I'm having a weird bug and wondering if anyone has ever seen this before A Hello World GUI app. Create an app.config. When you build, Studio copies app.config to bin\debug\ and renames it to the name of your EXE (sorta; turns out if your app is in a namespace, Studio names your EXE after the entire namespace but names your config file to only the app name and not the full namespace path, which in turn means your EXE cannot find it's...
3
10841
by: Steve Richter | last post by:
here is an error I get when I open my class library project: "The class ResultsTable can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again." What does that mean, "the class xxx can be designed"? thanks,
3
3458
by: Frank Rizzo | last post by:
How can I force an .EXE to use a different app.config file? For instance, I have an MyApp.exe which by default uses MyApp.exe.config file. Can I force it to use ThatApp.exe.config? Thanks
1
1294
by: Ben | last post by:
Hi, I write a simple dll in C# using Visual Studio 2005 Express, how can I make my dll strong name? (so I can put it into Global Assembly Cache) Ben
0
1223
by: dcp12345678 | last post by:
The code below is directly from Microsoft's help. It describes how to read a value from the Web.config file. I tried out this code and it does not appear to work (at least when I try it). If my web.config file I have the following: <appSettings> <add key="WebServer" value="localhost"/> </appSettings> I want to read out the WebServer value and I used Microsoft's code
1
1177
by: Ryan Liu | last post by:
Hi, I have a problem, I am using visual studio 2003 to develop Chinse application, works fine. But when I deploy it, Chinse font can not be seen for shortcuts or folder name created by Visual studio 2003 setup project. Is there a way to fix it?
1
4876
by: DR | last post by:
What ports do i need to unblock on client and server (running msvsmon.exe) to debug remotely from my client box with visual studio 2005 pro? When I attach to remote process a connection shows up in msvsmon.exe on the remote machine, however, the client box with visual studio displays error: "Unable to connect to the mricosoft visual studio remtoe debugging monitor named 'the box name' the micorosft visual studio remote debugging monitor...
3
1160
by: Mike | last post by:
Hi I am a newbie in Microsoft visual studio. According to the documentation, the solution can contain several projects. Each project can run with different platform with Win32 or x64. I don't understand this. I use Win32. Then I cannot run this solution on x64, can I? If I use x64 window OS, why should I choose Win32 platform?
1
4971
by: Nathan Sokalski | last post by:
On Microsoft's page about IE8 and Defining Document Compatibility at: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx They give the following code to add to Web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol>
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.