Just as follow up, I have also posted it under following forum:
http://forums.microsoft.com/MSDN/Sho...44809&SiteID=1
This seems really to be a bug when the following configuration is used:
VS2008, Vista and application run from a logical drive (defined with
"Subst")
--> in such a case the content of the application config file is not seen.
The forum moderator was able to reproduce the problem and I have reported
the bug to MS using
http://connect.microsoft.com/visualstudio/
José
"José Joye" <jose.joye__KILLTHESPAMS__SMAPSEHTLLIK__@bluewin.ch> wrote in
message news:496F4AC2-8EA2-49DF-B3C1-(E-Mail Removed)...
> I'm currently facing a problem when runnning an application on Vista from
> a logical drive (created with "subst").
> The problem occurs when the application is run from command prompt. All is
> ok if the application is run from the debugger.
>
> Say I have an application that is located under
> C:\temp\TestForSubst\TestForSubst\bin\debug
> Then I create a logical drive:
> >subst t: C:\temp\TestForSubst\TestForSubst\bin\debug
>
> If I do the following:
>>cd C:\temp\TestForSubst\TestForSubst\bin\debug
>>TestForSubst.exe --> all is fine and the values within the appConfig
>>section are printed
>
> If I do the following:
>>t:
>>TestForSubst.exe --> Nothing is printed regarding the appConfig section.
>
> Thanks a lot for any feedback!
> - José
>
> Here is my sample program:
> ===================
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.IO;
> using System.Configuration;
> using System.Collections.Specialized;
>
> namespace TestForSubst
> {
> class Program
> {
> // Show how to use AppSettings.
> static void DisplayAppSettings()
> {
>
> // Get the AppSettings collection.
> NameValueCollection appSettings = ConfigurationManager.AppSettings;
>
> string[] keys = appSettings.AllKeys;
>
> Console.WriteLine();
> Console.WriteLine("Application appSettings:");
>
> // Loop to get key/value pairs.
> for (int i = 0; i < appSettings.Count; i++)
> {
> Console.WriteLine("#{0} Name: {1} Value: {2}", i, keys[i],
> appSettings[i]);
> }
> }
>
>
> static void Main(string[] args)
> {
> string currDir = Directory.GetCurrentDirectory();
> Console.WriteLine("Current dir: {0}", currDir);
>
> string[] files = Directory.GetFiles(currDir);
> if (files.Length > 0)
> {
> Console.WriteLine("Files in directory:");
> foreach (string file in files)
> {
> Console.WriteLine(" " + file);
> }
>
> DisplayAppSettings();
> Console.Write("Press <Enter> to quit");
> Console.ReadLine();
> }
> }
> }
> }
>