Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > how to get Setup Installation folder path and fire c# component program
 

how to get Setup Installation folder path and fire c# component program

Hi All

I want to get Installation Path when Setup Program run.

I create File System of ApplicationFolder in Setup Project.

1. ApplicationFolder \MyAppName\Maintainance\Apps\MyAppName.exe
2. ApplicationFolder \MyAppName\Maintanance\Components\COM\MyApp.dll

When the Setup Program run. User Type different Drive or Path to install.
I want want to get the installation path and combine with my my dll path to add Enviromental Varialbe Path.
Now i used the following code to get Enviromental Varialbe Path value.

IDictionary envVars = Environment.GetEnvironmentVariables();
string DllPath = UserSelectedPath + @"MyAppName\Maintanance\Components\COM";
foreach (DictionaryEntry envVar in envVars)
{
if (envVar.Key.ToString() == "Path")
{
string EnVarVal = envVar.Value.ToString() + DllPath;
if (envVar.Value.ToString().Contains(DllPath) == false)
{
Environment.SetEnvironmentVariable("Path", EnVarVal, EnvironmentVariableTarget.Machine);
}
}
}

I want to know 2 things..
1. How can I make to fire/run my code Component during setup program.
2. How can I get user selected/typed installation folder path.


Thanks
WinZone
winzone  Thursday, August 13, 2009 1:34 AM
Hi all,

Now I got solution from this web link
http://www.codeproject.com/KB/install/Installation.aspx?display=PrintAll



WinZone
  • Marked As Answer bywinzone Thursday, August 13, 2009 7:45 AM
  •  
winzone  Thursday, August 13, 2009 7:45 AM
Hi all,

Now I got solution from this web link
http://www.codeproject.com/KB/install/Installation.aspx?display=PrintAll



WinZone
  • Marked As Answer bywinzone Thursday, August 13, 2009 7:45 AM
  •  
winzone  Thursday, August 13, 2009 7:45 AM
People have told me they have had issues with that method, mainly the GetExecutingAssembly() location being unreliable. The proper way to find the location of the Application Folder is to pass TARGETDIR via CustomActionData, as here:
http://msdn.microsoft.com/en-us/library/2w2fhwzz(VS.80).aspx
and here:
http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/
Phil Wilson
PhilWilson  Thursday, August 13, 2009 5:55 PM

You can use google to search for other answers

Custom Search

More Threads

• Deploying a C# .NET application on a local intranet
• Disable repair method on Openfile
• Installaing Prerequisites with msiexec command
• Setup regional settings
• .NET application not startup in Windows 2000
• Reading Installer Public Properties from a file.
• First application installs, seconds does not: URLDownloadToCacheFile failed with HRESULT '-2146697210'
• ClickOne with ODP.Net
• Install error: Configuration system failed to initialize
• Individual Update-Info (Description) in UpdateCheckInfo()