By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,595 Members | 3,721 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,595 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Aug 1 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
* 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
Aug 1 '07 #2

P: n/a
Bob
On Aug 1, 5:13 am, Jesse Houwing <jesse.houw...@nospam-sogeti.nl>
wrote:
* 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
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.

Aug 1 '07 #3

P: n/a
On Aug 1, 5:16 am, Bob <bshumsk...@yahoo.comwrote:
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

Aug 1 '07 #4

P: n/a
Bob wrote:
[...]
>>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
Aug 2 '07 #5

P: n/a
Bob
On Aug 2, 11:21 am, Peter Duniho <NpOeStPe...@NnOwSlPiAnMk.comwrote:
Bob wrote:
[...]
>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!!

Aug 3 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.