Setup Project File Path Options

D

Dave

Does anyone know how to set a .NET Setup Project to have it look in
the target directory where the installed files land up, and NOT in "C:
\WINNT\system32"?

After my Windows Service starts up i get the error: "Could not find
file 'C:\WINNT\system32\ConfigFile.txt'" (as it's not there, it's in
the user specified target directory). I.e. my Windows Service has a
config file that it needs to read upon startup...

I tried posting this on .dotnet.general with no responses and I'm
really stuck!

thanks so much, dave
 
J

John B

Dave said:
Does anyone know how to set a .NET Setup Project to have it look in
the target directory where the installed files land up, and NOT in "C:
\WINNT\system32"?

After my Windows Service starts up i get the error: "Could not find
file 'C:\WINNT\system32\ConfigFile.txt'" (as it's not there, it's in
the user specified target directory). I.e. my Windows Service has a
config file that it needs to read upon startup...

I tried posting this on .dotnet.general with no responses and I'm
really stuck!

thanks so much, dave
By default all services seem to run with the startup path set to
%system32%\.

Have a look at the Assembly class.
In particular:
Assembly.GetExecutingAssembly()
Assembly.CodeBase

You should be able to figure out your physical location and read from
there, you may not have permission though.

Why are you not using an app.config file instead, this avoids this whole
problem?

JB
 
D

Dave

By default all services seem to run with the startup path set to
%system32%\.

Have a look at the Assembly class.
In particular:
Assembly.GetExecutingAssembly()
Assembly.CodeBase

You should be able to figure out your physical location and read from
there, you may not have permission though.

Why are you not using an app.config file instead, this avoids this whole
problem?

JB

i was avoiding app.config as i didn't want to have to learn all that
is involved with using app.config. i may have to bite the bullet if
it can fix my woes though.

i also need to write to tracing / logging file, and would like to not
write to the system32 directory. files get created there by default
also, but this is secondary in importance to the config file issues.
 

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