Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6095435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:48:41+00:00 2026-05-23T12:48:41+00:00

I am working through an msdn example in VS08 on how to create a

  • 0

I am working through an msdn example in VS08 on how to create a custom installer and I have followed it to the letter. The only change I made was that I implemented the code in C# instead of VB. It compiles without any errors and appears to install, but the overridden install method is not being called and therefore, nothing is being “installed.”

From what I have read online while researching this problem, I have discovered that some people have had problems getting their uninstall method to be called, but their install method works fine. I decided to follow through on some of those suggestions thinking it might inadvertently help me, so my code is a little more flushed out than the msdn example, but none of the overridden functions at the bottom of my code are being called.

I have paid close attention to detail, but because of the seeming absence of documentation on this problem, I feel like I must be missing something simple. My code for the class library is below.

using System;
using System.IO;
using System.Reflection;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections;
using System.Configuration.Install;


namespace DBCustomAction
{
   public partial class CsDeployInstaller : Installer
   {
      public CsDeployInstaller()
      {
         InitializeComponent();
      }

      private string GetSql(string Name)
      {
         try
         {
            Assembly asm = Assembly.GetExecutingAssembly();
            Stream strm = asm.GetManifestResourceStream(asm.GetName().Name + "." + Name);
            StreamReader reader = new StreamReader(strm, System.Text.Encoding.Default);
            // System.Text.Encoding.ASCII;                  
            return reader.ReadToEnd();
         }
         catch (Exception ex)
         {
            Console.Write("In GetSql:" + ex.Message);
            throw ex;
         }
      }

      private void ExecuteSql(string DataBaseName, string Sql)
      {
         string ConnectionString = ConfigurationManager.ConnectionStrings["masterConnectionString"].ToString();             
         //string ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=master;Integrated Security=True";
         SqlConnection sqlConnection1 = new SqlConnection(ConnectionString);
         System.Data.SqlClient.SqlCommand Command = new System.Data.SqlClient.SqlCommand(Sql, sqlConnection1);
         Command.Connection.Open();
         Command.Connection.ChangeDatabase(DataBaseName);

         try
         {
            Command.ExecuteNonQuery();
         }
         finally
         {
            Command.Connection.Close();
         }
      }

      protected void AddDBTable(string strDBName)
      {
         try
         {
            ExecuteSql("master", "CREATE DATABASE " + strDBName);
            ExecuteSql(strDBName, GetSql("sql.txt"));
         }
         catch (Exception ex)
         {
            Console.WriteLine("In exception handler:" + ex.Message);
         }
      }

      public override void Install(IDictionary stateSaver)
      {
         Console.WriteLine("Install is working");
         base.Install(stateSaver);

         AddDBTable(this.Context.Parameters["dbname"]);
      }

      public override void Uninstall(IDictionary savedState)
      {
         Console.WriteLine("I am uninstalling this");
         base.Uninstall(savedState);
      }

      public override void Commit(IDictionary savedState)
      {
         Console.WriteLine("Commit Function");
         base.Commit(savedState);
      }

      public override void Rollback(IDictionary savedState)
      {
         Console.WriteLine("rollback works!");
         base.Rollback(savedState);
      }
   }
}

None of the Console.WriteLine commands ever get called. Just for fun, I also ran a trace to detect if the database was even being acknowledged by the installer and there was nothing.

Any help would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:48:42+00:00Added an answer on May 23, 2026 at 12:48 pm

    I don’t know how else to answer your question other than that this one works:

    http://msdn.microsoft.com/en-us/library/9cdb5eda(v=VS.100).aspx

    If you follow those steps you should be good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working through an example from MSDN that uses a small database to
I have been working through Josh Smith's article on MVVM at http://msdn.microsoft.com/en-us/magazine/dd419663.aspx . Each
I'm currently working through an assignment that deals with Big-O and running times. I
I'm working through Practical Web 2.0 Appications currently and have hit a bit of
I'm working through some MSDN examples, and some books on ADO.Net. What they all
Working through this for fun: http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/ Example calculation of nullable and first uses a
When working through MathLink with slave kernel I have a problem with correct parsing
I've been working through Practical Common Lisp and as an exercise decided to write
I'm working through previous years ACM Programming Competition problems trying to get better at
I've been working through a recent Computer Science homework involving recursion and big-O notation.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.