473,408 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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

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 1168

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

Similar topics

1
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...
3
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...
3
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...
3
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
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
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...
1
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...
1
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...
3
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...
1
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.