PC Review


Reply
Thread Tools Rate Thread

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

 
 
José Joye
Guest
Posts: n/a
 
      28th Feb 2008
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();
}
}
}
}

 
Reply With Quote
 
 
 
 
José Joye
Guest
Posts: n/a
 
      10th Mar 2008
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();
> }
> }
> }
> }
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logical Drive to Primary Partition in Vista? alg0r1thm Windows Vista Hardware 1 19th Sep 2009 07:29 PM
Vista logical drive and partition size discrepencies darvos Windows Vista Hardware 1 17th Jul 2008 03:25 AM
App config not seen when running from a logical drive on Vista?? José Joye Microsoft C# .NET 1 10th Mar 2008 03:57 PM
How do I make a logical drive D: on Vista Ultimate? MegaC Windows Vista Installation 3 27th Apr 2007 11:50 PM
I cannot format a partition to Extened partion with logical drive in Vista? Timu CHEN Windows Vista Installation 0 30th Oct 2006 06:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:00 PM.