Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Accessing file from Setup project
 

Accessing file from Setup project

HI,
I am creating a setup project for a desktop application in framework 2.0. The setup project needs to read some data from a remote server db, for that I have created a file (connection.config) with the remote server's connection string and zip it with the setup project. While running the setup I need to access the connection.config. I have tried with Application.StartupPath, Application.Executable path...but all these methods are returning only c:\windows\system32...

Can any one help me to access this file...

Thanks in Advance

Jayashree

jshree
  • Moved byYiChun ChenMSFTFriday, August 14, 2009 10:19 AMDeployment issue (From:.NET Framework Setup)
  •  
JayaShree Ganesan  Thursday, August 13, 2009 9:48 AM

If the config file is in the Application Folder, pass [TARGETDIR] through the CustomActionData property of the custom action. If you have an installer class, this is the syntax here:
http://msdn.microsoft.com/en-us/library/2w2fhwzz(VS.80).aspx

Custom actions are called from an msiexec.exe process, they do not run in the app's context.

However, I don't think what you want to do will work in a VS 2008 setup project. Your custom action will run with the system account, not your account, so you may find that it cannot access remote servers.


Phil Wilson
PhilWilson  Friday, August 14, 2009 7:25 PM
by zip with the setup project, did you mean put it under Application Folder of the setup project? it is a confusing term using zip because we have it as one of the file types...

anyway, how are you trying to access the file? is it through custom actions... if so, you can utilize the TARGETDIR property.
learn it, love it, live it
dreamlordzwolf - Michael Corpuz  Thursday, August 13, 2009 7:57 PM
Thanks for your reply. I mean, I will have the setup project and connection.config in the same path. Now I need to access the connection.config while running the setup project.
jshree
JayaShree Ganesan  Friday, August 14, 2009 3:56 AM
Hi JayaShree Ganesan,

I am moving this thread from Base ".NET Framework Setup" forum to the "ClickOnce and Setup & Deployment Projects" forum, since the issue is related to deployment. There are more deployment experts in the "ClickOnce and Setup & Deployment Projects" forum.

Thanks
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
YiChun Chen  Friday, August 14, 2009 10:18 AM
Okay...thanks
jshree
JayaShree Ganesan  Friday, August 14, 2009 12:12 PM

If the config file is in the Application Folder, pass [TARGETDIR] through the CustomActionData property of the custom action. If you have an installer class, this is the syntax here:
http://msdn.microsoft.com/en-us/library/2w2fhwzz(VS.80).aspx

Custom actions are called from an msiexec.exe process, they do not run in the app's context.

However, I don't think what you want to do will work in a VS 2008 setup project. Your custom action will run with the system account, not your account, so you may find that it cannot access remote servers.


Phil Wilson
PhilWilson  Friday, August 14, 2009 7:25 PM

You can use google to search for other answers

Custom Search

More Threads

• Identifying Compressed drive before deployment using clickonce
• Bypass "new version is available" dialog
• How to delete a file copied not by FileSystem when uninstall the product???
• Which method is being invoked when upgrade the existing installation :VS2008?
• Can any1 tell me how todo Update capability
• Adding multiple shortcuts to the Start Menu using Click Once
• Deployment update question
• How do make my program’s data to always follow the main directory of my program.
• uninstalling previous version
• click once newbie questions