J
José Joye
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:
If I do the following:
If I do the following:
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,
appSettings);
}
}
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();
}
}
}
}
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,
appSettings);
}
}
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();
}
}
}
}