Free Online Training VIDEOS,SAMPLES,TUTORIALS ON MCTS EXAM C#.NET(MS VISUAL STUDIO) Thanks for your support. The blog is getting bigger and better day by day. please check out : www.blog.sameershaik.com for further interesting articles on other microsoft certification examinations
Search this blog
You can search for all the topics in our blog using our google custom search now.
Search the blog
Loading
Thursday, September 9, 2010
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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment