I was wondering if anyone can help me with this problem. Here is my situation. I'm writing a program with Visual C# Express. My application stores some of it's settings in XML files and I store those files in the Application.LocalUserAppDataPath directory, which looks something like "\basedirectory\companyname\productname\version\Data\."
However, when I install the program on a machine using ClickOnce deployment, it doesn't store the files in that directory. It uses some key and randomly generates a new directory that looks something like "\basedirectory\Apps\2.0\KJF7LDFJ\KEJRCIULEKJR7\Data\"
Now this wouldn't be a problem except for one thing. I have a setting in my program that will automatically run the program when the machine boots up. And I did this by passing a pathname of the main .exe file and storing it in the registry. But here is where the problem comes in, when the computer boots up, or I try to run the .exe manually, it tries to find the "\basedirectory\companyname\productname\version\Data\." directory, and crashes. When I run the program from clickonce, or from the start menu through the Application Reference, it loads the "\basedirectory\Apps\2.0\KJF7LDFJ\KEJRCIULEKJR7\Data\" directory.
So I need to do one of two things. I need to modify the application manifest(if possible) so it installs in the "\basedirectory\companyname\productname\version\Data\." directory, or I need to modify the pathname to the exe in the registry and load the Application reference instead. But I don't know how to do that. How do I launch an application reference It's not actually a physical file that sits in the start menu, so I can't just call the file name. Any help or tips would be appreciated.
G

Application references
Lats
However, you want the application to run at boot time. Before (and here is my assumption) anyone has logged into the system. Before there would be a user to whom the isolated storage path could be assigned. This is the problem that you’re running into. And one for which there really is not solution.
You can’t have a ClickOnce application install itself so that it runs at boot time without a user being logged in. If it were possible, I’d like you to think about how large a security hole that would be. Instead, if you’re trying to get a start-up program installed, you’re going to have to fall back on getting them to install it manually.
And if my assumption was incorrect, then forgive my rant and try to clear up my misunderstanding.
Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce
gpermant
I don't necessarily need the program to install itself when the computer boots, or run before the user has logged in. It should boot up after they log in. My program sits in the system tray and I want it to run after the machine boots up, the same way programs like MSN Messenger are automatically loaded when you boot up windows. The user is logged in at that point when the programs load. And for the most part this works with my program.
The problem occurs when you launch the program from the exe as opposed to the application reference. Even if I find my program exe and launch it manually, it tries to find the "base\companyname\productname\version\data\" directory as opposed to the directory created by ClickOnce. So I need to find a way so that after the machine boots up, instead of loading my program exe, I need it to load the application reference instead.
I haven't been too happy with ClickOnce. If I could I would buy the full version of VS2005 and create an MSI to install all my programs, but I can't afford it at the moment so I'm stuck using C# Express and the ClickOnce deployment.
***Edited***
To clarify a little more. The user installs the programs themselves when they are logged in. It's the behavior of the program after it's installed that I'm running into a problem with. If the user goes to the Start Menu and launches the program from the start menu, it works great every single time. But if you launch the program directly from the .exe and not the app reference that's in the start menu, that's where I run into problems. And I have code where I'm trying to launch the program from the exe. And the easiest solution I can think of, is to change the code to where I launch the program through the application reference isntead of the exe. I just don't know how to do that.
G