How to run executable at end of Setup Project? - winforms

I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Project to run an executable after the install finishes. An ideas?
NOTE: You cannot use Custom Actions because these are used as part of the install process, I want to run my installed application once the user presses the 'Close' button at the end of the install.

I believe this is one of the real limitations of the Visual Studio installation project. You need to be able to modify the last page of the installation UI but VS.NET does not give you a way to do this. You could modify the tables in the .MSI after it has been built but VS.NET would probably overwrite these changes each time it is built. You may be able to override the last page using a merge module that you include in the installation project. Either way you will need to become familiar with how the UI dialogs are authored in an .MSI and this is not trivial.
You may want to consider switching to a free script based installer or buy a commercial setup authoring application (just don't buy InstallShield for the love of Pete). Take a look at InstallAware (although I have not used it).

I've just found a very easy way which does not require external tools. You only have to add a class file to the main project and a custom action to the setup project.
http://www.codeproject.com/KB/install/Installation.aspx

You also can use custom actions

I've done this for internal apps by creating a VB Script harness that launches the setup executable, waits for it to close, and then launches the second program.
You could also accomplish this with a little more polish using a few Win API calls in a C executable.

You can use MSILAUNCH (though I've only got it to work with MSICREATE).
http://www.cornerhouse.ca/en/msi.html

I managed it by doing invoking the Main method the assembly using the following line:
(typeof(ClassWithinAssemblyToExecute)).Assembly.EntryPoint.Invoke(null, new Object[] {} )

you can do it by custom installer. just add installer class and there u will see many event like after install, before install. just hook up after install and from there run ur exe by process class. i would suggest u google to find more about custom installer.
here is one good link that might help u http://www.codeproject.com/Articles/19560/Launching-Your-Application-After-Install-using-Vis
thanks

Related

Integrating a custom launcher into the Visual Studio Debugger

We're creating a Visual Studio Debugger extension that needs to launch the application being debugged through a custom launcher that sets up the runtime (not the CLR or Win32) and launch the target application in a new process. In other words, the custom launcher is in charge of creating the new process. In the VS Debugger, one typically launches the debugger by calling VsShellUtilities.LaunchDebugger() and supplying a VsDebugTargetInfo object whose dlo field is set to DEBUG_LAUNCH_OPERATION.DLO_CreateProcess, along with the coordinates of the exe file to be launched and debugged. This doesn't conform to our launching model.
There is also a dlo value DEBUG_LAUNCH_OPERATION.DLO_Custom that seems to be for this purpose (using the clsIdCustom field to indicate the launcher), but the current documentation says that's obsolete and directs us back to DEBUG_LAUNCH_OPERATION.DLO_CreateProcess, but not only doesn't that fit our model, but clsidCustom is used in this case to indicate the debug engine (if it's just a single one).
So, what is the recommended way for us to launch the VS debugger and use our custom launcher to configure and start our runtime (and the application within it)?
According to the Visual Studio API document, it only provide the DLO_CreateProcess to Launches the process. You could use dwClsidCount and pclsidList specify the debug engines to use.
Following example introduce how to call a custom launcher through a VSIX project.
https://code.msdn.microsoft.com/Visual-Studio-Debug-Engine-c2e21c0e
I'm having difficulty porting to a Modern VS2022 but I've been using the VSIX template built of of this Extension which works for VS2017 and VS2019. after some tinkering. This does work for VS2022 but only if you don't tamper with the packages.
https://github.com/microsoft/VSProjectSystem/blob/master/doc/extensibility/IDebugLaunchProvider.md Good luck there's not a lot out there so I thought I'd offer you this gem.
This allows you to make a drop done selection for a project property sheets for debugging. you got to import the targets file which then imports the rules sheet that you create which means you got to make a wizard that creates a custom project.

Windows Phone Toolkit: Do I really need to install it using NuGet?

My situation is the following. I'm developing a simple app for my Windows Phone 8 using Silverlight. At some point, I need to add an extra functionality like context menu to my app. It seems, it is enough to add a "normal" reference to the Microsoft.Phone.Controls.Toolkit.dll assembly instead of adding the corresponding NuGet reference that installs a lot of stuff in its package I really do not need at all.
So the question is: do I really need to add it as a NuGet package if the functionality provided by the DLL is enough?
I'm asking because I like to keep my projects as clean as it is possible, and I do not like to add unused stuff that eventually makes my projects very big and complex.
Using Nuget instead of referencing a dll in some folder in your project is the more clean way.
If you add all your references through Nuget, it will provide many benefits, like automatic depedencies resolution and download, upgrades to newer versions, restoring on build and no need to check them into version control system ...

How can I determine an application's software prerequisites?

I'm developing a small WinForms program for home use - I have no intentions to releasing it anywhere.
Running it on my development machine, where I have Visual Studio and .NET and whatever else installed, works but deploying it on my PC, where I might not have all those frameworks, doesn't. I'm using some library written in C++ so I'm assuming I'm going to need some version of Visual C++ Redistributable, but I'm not sure which? And I'm not sure if that would be all. So, how can I determine an application's software prerequisites?
I used Dependency Walker and I got a message IEHIMS.DLL - Error opening file. The system cannot find the file specified (2), but that's all I could make out; there is so much information I'm having trouble make sense of it all. Besides, according to a quick google, IESHIMS.DLL has something to do with Internet Explorer, so it shouldn't really matter.
Thanks in advance to anyone taking to the time to consider my question.
Kind regards
For framework you can set the prerequisites for your application by going to project properties -> Publish -> Prerequisites. So now, if the required framework is not installed on the deployment machine, the setup will prompt for an install.
Now, for other dlls you are using, copy those dlls to your bin folder of the project and add the files while creating setup. This will solve the problem.

Can you have MsTests and Windows-forms functional tests live in the same project file?

I've been asked to investigate the possibility of using a single .csproj file to run both interactive and unit tests. I've been able to get the windows forms project changed over to run msTests but now I'm not finding a way to run the windows forms/interactive side. Is there a way to do this?
There are only 2 methods I've found for what my team was looking for. nUnit instead of MsTests, or manually executing the /debug built win-forms executable and then attaching the debugger to it. So nice clean integration using MsTests/VS2010 is out the window.

WPF deployment strategy dilemma.clickonce(limited customization)+autoupdate vs installer(unlimited costomization) no autoupdate

I've been facing a deployment problem.I've built a WPF application with visual studio 2008 and created an installer(msi) which works fine.But then it's pain to add automatic update to it. i've seen this article at windowsclient.net but it seems to be pretty old but could have been the perfect thing for me.Then i looked at the .Net Application updater block v2.0 which uses enterprise library june 2005 and for some reason it's not installing on my machine.
I thought i will need to use a more recent Enterprise library so i installed and compiled Enterprise 4.1(october 2008) but nothing better happened.To i decided to give a try to CLickonce deployment.After struggling with it, it was almost perfect.I realized that when i was testing the updates provided by the clickonce on my machine which is XP i didn't notice the need of having sqlite dll in the GAC. surely it was already there.I noticed it when i moved to vista that there is a problem.After checking the net i know it's impossible to add a dll to the Global Assembly Cache.
Now i'm stuck, i think i've hit a wall.Can any one share some of his experience? I'm willing to try the updater block if i can get help.
Thanks for reading this!!
(Won't fit in a comment)
Here's something helpful -- you can deploy the SQLCE dll's locally, instead of installing as a prerequisite, which makes it easier to deploy. Check out this article.
This is another useful article: how to keep your data safe from ClickOnce updates.
This will make more sense if you check out this thread. I have a post in this thread that has two links in it. One points to the ClickOnce way of handling database deployment, the other to a thread that is essentially the same as the blog article above.
First, you can't use that updater block. It was for .NET 1.1. It was marked obsolete when ClickOnce deployment was added in .NET 2.0.
You probably don't need to install that dll in the GAC. In many cases, you can just include it in the deployment, and it will find the local reference and use it. It just depends on the dll. So here's what I recommend you try:
Add the dll to your project. Set the 'build action' to 'none'. Set 'copy to local directory' as 'do not copy'.
Delete the reference in your project to that dll, and re-add it. But instead of picking it from the GAC, browse to the one you just added to your project and select it. On the reference properties, set 'copy local' to 'true'.
Now when you run it, it will access the local copy instead of looking for one in the GAC.
Like I said, this works great in some cases. It works for SQLCE and DirectX, but not for something like Infragistics. Some assemblies really do have to be installed in the GAC. The only way you will know is if you try it.
If you DO end up having to put it in the GAC, you can create an MSI to do that and deploy it as a prerequisite to the ClickOnce application. So you can still use ClickOnce for your main app.

Resources