|
There is no need to call your application and encouter all these problems.
Create a Batch file say uninstall.bat with the following two lines:
@echo off
%Windows%\system32\msiexec.exe /x %1
Add an additional shortcut-link (to the batch file) in your deployment
Set the Arguments property to: [ProductCode] (just the poductcode without the /u=)
Set the ShowCmd to vsdscMinimized
finish
If you like to create a real Shortcut than you have to do some more.
Ref. to the articles: 'Conditional Install of Desktop and Quick Launch Shortcuts'
|
|
|
|
|
Hi. I like the sound of this solution however I can't get it to work. Precisely how do you add the batch file to the installer and shortcut it?
Here's what I tried:
Create the .bat file in notepad and save it to my project directory. Add the file directly to the Setup Project. Output the file to the application folder. Create a shortcut in a Programs Menu folder to the batch file in the application folder, setting the argument to [ProductCode], and so forth.
However when I run the install, although the shortcut appears in the start menu, and the batch file is properly installed to the application folder, the shortcut itself is blank (no target).
What am I doing wrong??
|
|
|
|
|
Aha, turns out the environment variable should have been %SystemRoot%, not %Windows%, at least for me, running WinXP SP2.
|
|
|
|
|
Hi,
I have created a MSI from multiple projects. Is it possible to uninstall the MSI with one unistall item added to the Program's Menu. If it is possibel thn can u let me know hw can i achieve this.
U can contact me on my email apondu@gmail.com
Thanks for ur help.
Regards,
Yachitha
hi
|
|
|
|
|
I tried your method -it's pretty good- but after uninstalling the app folder still exists. I guess the reason is that the uninstaller is being invoked from the app executable, so the folder is access-protected until the execution ends and uninstaller cannot remove it. (However, it does remove the executable itself... )
Any workaround for this? Thanks
Enric Carrión
|
|
|
|
|
I found it! I simply had to change the WorkingFolder of the shortcut to any different folder than the application directory (i.e. "User's Desktop").
Thank you anyway. Good job!
Enric
|
|
|
|
|
I have tried to do this. This don't work. I will glad an any help. Thanks.
|
|
|
|
|
Hi
Does anybody know answer to following problem.
Problem : I am creating deployment for C# apllication using dot net deployment & setup project.
I have created registry entries ( Ex. Server Name)and one edit dialog box for user input(Ex. IBM0505d-040). Now I want to write user input ( Ex.IBM0505d-040) as value of Server name registry entry at the time of installation.
Pls reply
Jitendra C.
|
|
|
|
|
Using registry is against .NET best practices. Try using configuration files, unless you need to maintain backward compatibility or you need to work in conjunction with another (old-fashioned) application that reads the data from registry.
|
|
|
|
|
Personnaly, I prefer to use the /x argument with Msiexec ... /i is for installing and when the software is already installed, it shows a dialog proposing to repair or uninstall your product. With the /x, it only asks for a confirmation.
See Msiexec arguments list[^] for more details.
|
|
|
|
|
:|The code don't work in web aplications.
Then, i create a new console project called UninstallProgram and add a class called UninstallClassP. After i program this code:
public static void Main(string[] args)
{
string[] arguments = Environment.GetCommandLineArgs();
foreach(string argument in arguments)
{
if (argument.Split('=')[0].ToLower() == "/u")
{
string guid = argument.Split('=')[1];
string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(path + @"\msiexec.exe", "/x " + guid);
si.UseShellExecute = false;
System.Diagnostics.Process.Start(si);
//Close();
//Application.Exit();
}
}
}
In my websetup project in FileSystem editor i add a primary output from UninstallProgram and I create a shortcut from this primary output.
After i select create a special Folder "User's Program Menu" and paste in it the shortuct created in previous step.
That's all.
Victor Velepucha.
MCSD.NET
|
|
|
|
|
... if you're designing for winxp logo compliance you shouldn't put the uninstall program on the start menu because add/remove in the control panel is where it's supposed to be cleaned up. IT's not an requirement at the moment, it's listed as a best practice in the section of planned future requirements.
|
|
|
|
|
This code does not eliminate the add/remove icon in control panel. It simply adds another way to uninstall the app. IIRC, logo compliance requires the uninstall to be in the control panel, but does not require it to be absent from the start menu.
|
|
|
|
|
You're right that it's not forbidden yet, but it's listed as a best practice in the section that's used to preview planned additions to the next version of the guide, and longhorn will be out before too much longer.
|
|
|
|
|
That's what I was just going to say ! The very first thought I had, even before I'd finished to read the title : "Isn't it against the Designed For XP logo ?"
Michael CARBENAY
Creo Ignem
|
|
|
|
|
I dont see anywhere that Windows XP logo compliance forbids a start menu uninstall entry, as long as the uninstall is ALSO in the control panel.
Regardless, the reasons why you might want to do this in addition to the normal add/remove icon is that A) many users expect to see it, and B) the uninstall process is far quicker on most machines in operation (most of which are 3-5 years old) than wading though control panel icons and waiting for the add/remove programs list to populate and calculate disk space usage for every application in its list before ever giving you the opportunity to uninstall.
Further, when doing support, it is far easier to instruct a computer novice to go to the uninstall entry right next to the application that they are familiar with in order to uninstall the application than into the control panel which they might never even known exists.
|
|
|
|
|
It's not a requirement, but it's in the Future requirement sections. F1.1 precisely states :
• Do not place shortcuts to remove the application in the Start menu. It is not needed because your application’s uninstaller is in the Add or Remove Programs Control Panel item.
but you're right, there's no need for doing so at this point. I suppose that "designed for hasta-la-vista baby" (oooopss...) will have this as a requirement.
Besides I have done enough user support to know that, basically, an untrained user will already have gone to the program files and deleted the folder (thanks to his son, nephew or any adolescent kid that he knows and who have said so) by the time he thinks about calling support.
That said, I still strongly find that your tip about how to do it is good, it's just that it should be pointed out that, if you're an hardcore microsoft-er, you should avoid making things that you'll have to remove in future version of windows and obviously things that Office don't do (ok, let's say that you shouldn't do a such componentized install : it makes the life of network-installed-office-user such a pain, but the rest sounds sensible).;P
Michael CARBENAY
Creo Ignem
|
|
|
|
|
I think we are in agreement here. I offer the opportunity for those, like me, who wanted it form the beginning. If it came down to being actually against the logo compliance, I would still do it for the sole reason that many of my users expect to see it.
|
|
|
|
|
|
i tried the code (converted to c#) but it got strange reaction.
when i press the uninstall icon the application runs an the uninstall dialog too.
when i press Remove it stuck with error about the application that holds my resources (that i want to uninstall) -
so i need to shutdown the application and press Retry.
isn't there a way to make uninstall without showing the Application in the background?
i tried the code before the "InitializeComponents" and after that before the "Application.Run(new MainForm());" in the static method "Main".
any suggestions or other ways to make uninstall?
Avi.
|
|
|
|
|
In VB I saw this effect only if I called Process.Start after InitializeComponent. This might be a difference between how VB and C# handles initializaion. I will check into this and see if I can determine the precise cause, and a solution.
|
|
|
|
|
Okay, try this... Change the code in the "/u" if block to the following:
_uninstallGuid = argument.Split("=")(1)
AddHandler Application.ApplicationExit, AddressOf UninstallOnApplicationExit
Application.Exit()
End
... And add the following code:
Private _uninstallGuid As String
Sub UninstallOnApplicationExit(ByVal sender As Object, ByVal e As EventArgs)
Dim path As String = _
Environment.GetFolderPath(Environment.SpecialFolder.System)
Dim si As New ProcessStartInfo(path & "\msiexec.exe", "/i " & _uninstallGuid)
Process.Start(si)
End Sub
You will have to convert it to C#, but this might work better for you. If it works, let me know and I will update the article.
It is also possible that .NET is not completely exiting because it still hasn't disposed fo all resources. If that is happening you can try explicitly calling for garbage collection and then calling Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System & "\msiexec.exe", "/i " & _uninstallGuid) without creating a path String or si ProcessStartInfo. This way the minimum number of objects will be left to be cleaned up when the application tries to exit.
|
|
|
|
|
well, i tried your new code but with no success,
the application is Up and just when i exit it the uninstall program runs.
well, i'll try to find out other way,
i'll let you know if i'll come into one.
thanks man,
Avi.
|
|
|
|
|
To avoid opening your app form, move your uninstallation code to the Main()
[STAThread]
static void Main()
{
string[] args=Environment.GetCommandLineArgs();
foreach(string arg in args)
{
if(arg.Split('=')[0].ToLower()=="/u")
{
string guid=arg.Split('=')[1];
string path=Environment.GetFolderPath(System.Environment.SpecialFolder.System);
string str=path+"\\msiexec.exe";
ProcessStartInfo pi=new ProcessStartInfo(str);
pi.Arguments="/i "+ guid;
pi.UseShellExecute=false;
Process.Start(pi);
return;
}
}
Application.EnableVisualStyles();
Application.Run(new MyForm());
}
Regards,
John
|
|
|
|
|
is this the only code that i need to have or should i had some events also (like in the other responsed before),
because it still not working
|
|
|
|