Search this blog

You can search for all the topics in our blog using our google custom search now.

Search the blog

Loading
Showing posts with label Installing and Configuring Applications. Show all posts
Showing posts with label Installing and Configuring Applications. Show all posts

Thursday, September 9, 2010

How to create Custom Installers?

Hi,

This video tutorial will show you how to create custom installers. This example uses topic from Logging Application State, if you haven't seen its example.Check out the below link:

Logging and System Management

I have divided the tutorial in two part. The links are below:
1. How to create Custom Installers Part 1
2. How to create Custom Installers Part 2

How to create Custom Installers Part 2



Code for MyInstaller.cs class is as given below :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration.Install;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;

namespace SimpleApplication
{
    [RunInstaller(true)]
    public class MyInstallerClass : Installer
    {

        public MyInstallerClass()
            : base()
        { }

        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);
        }

        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
            CreateEventLog();
        }
        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);
            DeleteEventLog();
        }
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);
            DeleteEventLog();
        }

        public void CreateEventLog()
        {
            if (!EventLog.Exists("SimpleApplication Log"))
            {
                EventLog.CreateEventSource("SimpleApplication", "SimpleApplication Log");
            }
        }

        public void DeleteEventLog()
        {
            if (EventLog.Exists("SimpleApplication Log"))
            {
                EventLog.DeleteEventSource("SimpleApplication");
                EventLog.Delete("SimpleApplication Log");
               
            }
        }
    }
}

Code for program.cs is as given below :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is my simple application");
            Console.ReadKey();
        }
    }
}


Regards
Sameer Shaik

Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test

How to create Custom Installers part 1



Regards
Sameer Shaik

Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test

Monday, August 2, 2010

Configuring Applications

Why do you need to configure your application?
A. Once you finish creating an application, you would want to save some settings like user settings or database connection settings or information stored between different sessions etc etc. Though dot net takes cares of most of the applications settings in machine.config file, we can always override the settings in machine.config file by creating a custom config file for our application.

In this example we will see how to create our own .config file for our application and configure the .config file for our application requirements.

Video Tutorial Part -- 1



Video Tutorial Part --2




Regards
Sameer Shaik

Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test