Link to home
Start Free TrialLog in
Avatar of kvnsdr
kvnsdr

asked on

Visual Studio Setup and Deployment Project and .bat files???

Okay, Microsoft has a pretty slick method of deploying projects, especially with the 'prerequisites' settings.

However, I need to run an SQL script at the end of the installation to build a new database for SQLExpress.

Q. Is there any way to run a .bat or .sql within the VS2005 Setup Deployment project???
Avatar of gsalier
gsalier

If you add an Installer.cs to your main project and override the Install and UnInstall methods
(Add the System.Configuration.Install to your project references)

using System;
using System.Configuration.Install;

namespace ExpertsExchange.Q_21804504
{
      /// <summary>
      /// Summary description for Installer.
      /// </summary>
      [RunInstaller(true)]
      public class Installer : Installer
      {
            public Installer()
            {
                  //
                  // TODO: Add constructor logic here
                  //
            }

            public override void Install(System.Collections.IDictionary stateSaver)
            {
                  base.Install (stateSaver);
                  //Write your code to execute your sql script
            }

            public override void Uninstall(System.Collections.IDictionary savedState)
            {
                  base.Uninstall (savedState);
                  //Write your code to get rid of the Sql Script
            }
      }
}
ASKER CERTIFIED SOLUTION
Avatar of gsalier
gsalier

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kvnsdr

ASKER

Interesting, but are we talking about the same thing.

I like the VS2005 .NET 2.0 Installer Project and it's use of 'Prerequisites' (much like Click-Once).

I'm not sure how the installer.cs can install the SQL scripts like Wise or InstallSheild do....

I need something that will simiulate a simple, no-hands-on end-user install.

So when the end-user double-clicks his desktop Icon, everything is installed with nothing for the end-user to do.

Sorry if I maybe missing your point.

I'm very interested and need additional explaination.....

The word 'Override' makes me think this installer.cs may compromise the VS Installer....

Help me understand.............


 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kvnsdr

ASKER

Okay, I've downloaded and inspected the project from the link above:

http://www.codeguru.com/csharp/.net/net_security/encryption/article.php/c9601/

I understand they added an 'Installer.cs' into thier application project.

It's like an installer wrapped within another installer.

Q. What 'fires' the installer to do it's job?
Avatar of kvnsdr

ASKER

Here's another link I found concerning the Installer class!

http://www.c-sharpcorner.com/Code/2002/July/UseInstClasses.asp

Thank you all..............

><>