problem writing to network drive, visual studio 2005 service pack 1

B

Bob

Hi,
I have some very simple code that I have been using for quite a while
that uses a streamwriter to write to a network file. I have never had
any problems with it. I recently updated Visual Studio 2005 with
Service Pack 1 and now it gives me the "Directory not found "
exception when I try to write to a network location. I am running it
on Vista as a standard user. However, I have opened Visual Studio
using the "run as administrator". The program still works fine when I
run it with Visual Studio c#. The code throwing the exception is:
using (StreamWriter sw = new StreamWriter(inpFileName)). How can I
fix this?

Thanks,
Bob
 
J

Jesse Houwing

* Bob wrote, On 1-8-2007 11:16:
Hi,
I have some very simple code that I have been using for quite a while
that uses a streamwriter to write to a network file. I have never had
any problems with it. I recently updated Visual Studio 2005 with
Service Pack 1 and now it gives me the "Directory not found "
exception when I try to write to a network location. I am running it
on Vista as a standard user. However, I have opened Visual Studio
using the "run as administrator". The program still works fine when I
run it with Visual Studio c#. The code throwing the exception is:
using (StreamWriter sw = new StreamWriter(inpFileName)). How can I
fix this?


Have you looked in the debugger what the value of inFileName is? Maybe
it's not what you expect it to be.

Jesse
 
B

Bob

* Bob wrote, On 1-8-2007 11:16:


Have you looked in the debugger what the value of inFileName is? Maybe
it's not what you expect it to be.

Jesse

Yes. The file name is what I expect it to be, is listed in the
exception, and the code runs fine in c# express or for writing to
local drives.
 
A

Andy

I have some very simple code that I have been using for quite a while
that uses a streamwriter to write to a network file. I have never had
any problems with it. I recently updated Visual Studio 2005 with
Service Pack 1 and now it gives me the "Directory not found "
exception when I try to write to a network location. I am running it
on Vista as a standard user. However, I have opened Visual Studio
using the "run as administrator". The program still works fine when I
run it with Visual Studio c#. The code throwing the exception is:
using (StreamWriter sw = new StreamWriter(inpFileName)). How can I
fix this?

I've had this problem too. Basically you're running VS as an admin
user, and its seems to be in some kind of different "context," and the
mapped drive is not available to VS (Vista keeps drives unconnected
until you open them). The solution for me is to open the References
dialog, goto the Browse tab, and type the mapped drive (such as R:\)
and press enter. you'll see the list of files / folders you expect on
the drive. You shouldn't need to do in anymore, unless you log off
your user.

HTH
Andy
 
B

Bob

I've had this problem too. Basically you're running VS as an admin
user, and its seems to be in some kind of different "context," and the
mapped drive is not available to VS (Vista keeps drives unconnected
until you open them). The solution for me is to open the References
dialog, goto the Browse tab, and type the mapped drive (such as R:\)
and press enter. you'll see the list of files / folders you expect on
the drive. You shouldn't need to do in anymore, unless you log off
your user.

HTH
Andy

Thanks very much. That works. But it seems like I have to do it
every friggin time I open Visual Studio to work on the project. That
is an enormous pain. Is there some other way around this? It seems
ridiculous that I effectively have less resources because I am running
as an administrator!!
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".
Alternatively, I could stop using the standard account and run from
the main account. I would prefer not to do this because of a) the
better security of the standard account and b) my work is currently in
the standard user's documents directory, which surprisingly seems to
be invisible to the administrative accounts, so I would have to move
all my projects and likely update a whole bunch of references between
projects.

Thanks,
Bob
 
B

Bob

I've had this problem too. Basically you're running VS as an admin
user, and its seems to be in some kind of different "context," and the
mapped drive is not available to VS (Vista keeps drives unconnected
until you open them). The solution for me is to open the References
dialog, goto the Browse tab, and type the mapped drive (such as R:\)
and press enter. you'll see the list of files / folders you expect on
the drive. You shouldn't need to do in anymore, unless you log off
your user.

HTH
Andy

Thanks very much. That works. But it seems like I have to do it
every friggin time I open Visual Studio to work on the project. That
is an enormous pain. Is there some other way around this? It seems
ridiculous that I effectively have less resources because I am running
as an administrator!!
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".
Alternatively, I could stop using the standard account and run from
the main account. I would prefer not to do this because of a) the
better security of the standard account and b) my work is currently in
the standard user's documents directory, which surprisingly seems to
be invisible to the administrative accounts, so I would have to move
all my projects and likely update a whole bunch of references between
projects.

Thanks,
Bob
 
B

Bob

I've had this problem too. Basically you're running VS as an admin
user, and its seems to be in some kind of different "context," and the
mapped drive is not available to VS (Vista keeps drives unconnected
until you open them). The solution for me is to open the References
dialog, goto the Browse tab, and type the mapped drive (such as R:\)
and press enter. you'll see the list of files / folders you expect on
the drive. You shouldn't need to do in anymore, unless you log off
your user.

HTH
Andy

Thanks very much. That works. But it seems like I have to do it
every friggin time I open Visual Studio to work on the project. That
is an enormous pain. Is there some other way around this? It seems
ridiculous that I effectively have less resources because I am running
as an administrator!!
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".
Alternatively, I could stop using the standard account and run from
the main account. I would prefer not to do this because of a) the
better security of the standard account and b) my work is currently in
the standard user's documents directory, which surprisingly seems to
be invisible to the administrative accounts, so I would have to move
all my projects and likely update a whole bunch of references between
projects.

Thanks,
Bob
 
B

Bob

I've had this problem too. Basically you're running VS as an admin
user, and its seems to be in some kind of different "context," and the
mapped drive is not available to VS (Vista keeps drives unconnected
until you open them). The solution for me is to open the References
dialog, goto the Browse tab, and type the mapped drive (such as R:\)
and press enter. you'll see the list of files / folders you expect on
the drive. You shouldn't need to do in anymore, unless you log off
your user.

HTH
Andy

Thanks very much. That works. But it seems like I have to do it
every friggin time I open Visual Studio to work on the project. That
is an enormous pain. Is there some other way around this? It seems
ridiculous that I effectively have less resources because I am running
as an administrator!!
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".
Alternatively, I could stop using the standard account and run from
the main account. I would prefer not to do this because of a) the
better security of the standard account and b) my work is currently in
the standard user's documents directory, which surprisingly seems to
be invisible to the administrative accounts, so I would have to move
all my projects and likely update a whole bunch of references between
projects.

Thanks,
Bob
 
A

Andy

Thanks very much. That works. But it seems like I have to do it
every friggin time I open Visual Studio to work on the project. That
is an enormous pain. Is there some other way around this? It seems
ridiculous that I effectively have less resources because I am running
as an administrator!!

Yes, you're right that it does that to me as well. One way around is
to simply leave VS open and close your solution and open the next one
you need to work on. Not great, but its the only way I've found
around this problem.

I THINK this happens because you're actually getting an isolated logon
session, similar to if you executed runas to run VS as another user.
I don't know if you've hit this, but you can't doubleclick .sln files
to open VS, nor can you drag any files from the file system to VS to
have VS open the file for editing.
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".
Alternatively, I could stop using the standard account and run from
the main account. I would prefer not to do this because of a) the
better security of the standard account and b) my work is currently in
the standard user's documents directory, which surprisingly seems to
be invisible to the administrative accounts, so I would have to move
all my projects and likely update a whole bunch of references between
projects.

Unfortunately it doesn't seem like you can really run VS without
administrator privledges.

See:
http://msdn2.microsoft.com/en-us/vstudio/aa972193.aspx
 
P

Peter Duniho

Bob said:
[...]
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".

I have been barely following this thread, mainly because the issue is so
foreign to me. It's not something I've ever seen, and so I don't really
have any suggestions for how to fix it.

That said, I can confirm without reservation that Visual Studio 2005
works fine when run without administrator privileges, at least under
Windows XP. You'll want to run it once as an admin, so that it can set
some stuff up, but that's not strictly necessary (I was able to create a
project, compile, and run it all without admin privileges) and you only
have to do it once.

If you are getting some other error running not as an admin, there is
something else unusual going on with your configuration, and your time
would probably be better spent figuring that out.

Of course, on top of all that, I have no good explanation for why your
application cannot use a network drive depending on which user it's run
under. I've never had that issue before, with VS or any other
application for that matter. Drive connections work for me regardless
of user privileges.

Are you running Vista? I'm not, so if you are that could explain why I
haven't run into that sort of thing.

Pete
 
B

Bob

Bob said:
[...]
From your description of the problem it seems like I wouldn't have
this problem if I ran Visual Studio not as an administrator but when I
try to do that it gives me some very frightening error message that my
project "could not be opened because the Microsoft Visual c# 2005
compiler could not be created. Please re-install Visual Studio".

I have been barely following this thread, mainly because the issue is so
foreign to me. It's not something I've ever seen, and so I don't really
have any suggestions for how to fix it.

That said, I can confirm without reservation that Visual Studio 2005
works fine when run without administrator privileges, at least under
Windows XP. You'll want to run it once as an admin, so that it can set
some stuff up, but that's not strictly necessary (I was able to create a
project, compile, and run it all without admin privileges) and you only
have to do it once.

If you are getting some other error running not as an admin, there is
something else unusual going on with your configuration, and your time
would probably be better spent figuring that out.

Of course, on top of all that, I have no good explanation for why your
application cannot use a network drive depending on which user it's run
under. I've never had that issue before, with VS or any other
application for that matter. Drive connections work for me regardless
of user privileges.

Are you running Vista? I'm not, so if you are that could explain why I
haven't run into that sort of thing.

Pete

Thanks for your responses. Pete, I have noticed all the problems you
said. The not being able to open a solution by selected it is another
real pain. I really wish I had never upgrade with Service Pack 1!!
 

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