App config not seen when running from a logical drive on Vista??

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:
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();
}
}
}
}
 
J

José Joye

Just as follow up, I have also posted it under following forum:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2944809&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 said:
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,
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();
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top