Categories
.NET How To Visual Studio

Creating MSI installer for Application

Recently I was tasked to create MSI installer for our current application which is in development phase. While browsing project types in VS, I had known that VS has ability to create installer using Install Shield, but that was pretty much of it. I have never worked with them before. But after working with windows installation project for few days, it looks pretty straight forward process to me. I mean of course, we can customize installer anyway we want and it can get pretty complex subject, but out requirement was not so fancy (at least at this moment Fingers crossed) so I am overall enjoying working with it.

For this demo I have created a very simple console application in C# and I am creating installer for that app. This installer will allow user to install that app to any location, just like any other app. And this application is targeted for only 32bit machines. This console application basically runs in a loop until user quits it, with each loop it displays two random number and user is required to add them (I know its pretty basic app .. but this demo is for installer not for some fancy app Smile). I am actually following old MSDN walkthrough which explains step-by-step process to create MSI installer.

First, I have created a console application project “Installer Demo”. Like below.

[csharp]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InstallerDemo
{
class Program
{
static void Main(string[] args)
{
char cont;
do
{
Random r = new Random();
int i = r.Next(1, 10);
Console.WriteLine("First Number: {0}", i);
int j = r.Next(1, 10);
Console.WriteLine("Second Number: {0}", j);
Console.Write("Total is: ");
int k = i + j;
var l = Console.ReadLine();
Console.WriteLine(k == Convert.ToInt32(l) ? "True" : "False");
Console.WriteLine("Another Addition ?? Y/N");
cont = Convert.ToChar(Console.ReadLine());
} while (cont == ‘Y’ | cont == ‘y’);

Console.WriteLine("Bye");
Console.ReadLine();
}
}
}

[/csharp]

 

Categories
.NET How To Windows

Setting up personal Source Control Server using Visual SVN Server

I was working on one of my personal projects and I thought that it would be really cool if I have my own source control mechanism so I can always rollback to older versions if I ever need to do it. Till now, I was always just keep multiple copies of each project so if I have to rollback or even just have to compare files then I just open them up and compare it. But with my prolonged exposure to SVN, I found that it is more easy if I have some sort of source control server, I can use it to keep all of my repositories and it will make my like more easy. So just last night I finally completed that task.

Tools of trade,

To setup dedicated Visual SVN Server I used virtual machine with Windows 2008 Server (having 16 Gigs of RAM really helps Open-mouthed smile). Just make sure that machine has static IP, because DHCP will have random IP of machine and then it could be wonky for SVN Server.

Categories
.NET ASP.NET Ubuntu

Developing ASP.NET Application in MONO under Linux

Today, I was playing with my new install of Linux. I installed Mono in it… (for those who don’t know what is MONO, is a cross platform IDE that can be used to develop .NET application in any environment) .. With my past encounters with Mono, I know that it is sort of complicated to make Mono work properly and you need to configure it specifically to work without glitch 🙂 … but with this newer Ubuntu 11.04, the process was way too simple.

During installation from "Ubuntu Software Center" I can select which add-on I want to install with Mono and everything will be configured automatically !! So only user intervention is just to select which add-on they want. Once you are done with installation you can fire up the application and start coding right away. Well, it is other case if you are way too much habituated with drag ‘n drop Visual Studio environment then you will find it a bit difficult to work with Mono since it doesn’t have VS like rich UI. But I say, it is way better then what you can get in Linux.

Sample Code:

<form id="form1" runat="server">

<asp:Button id="Button" runat="server" Text="MONO" OnClick="Button_Click"/>

<asp:Label id="Label" runat="server" Text=""/>

</form>

protected void Button_Click (object sender, EventArgs e)

{

Label.Text = "Hello Mono !!";

}

I guess this is one more reason to use Linux 🙂 …

That’s it for now ….

Gaurang Sign

Categories
.NET ASP.NET IIS Tips

.NET Framework 4 and Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’ Error …

 

So, day before yesterday I was working on some app. And I deployed it on my IIS (v7.5) server. The deployment process went very well without any sort of troubles. But when I tried to run that application from my web browser I got loads of error. And I found that the main error was something like this,

Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

Description: An unhandled exception occurred during the execution of the current Web request. Review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

 

With little googling, I found that I was not the first victim of this error !!! And after few clicks I finally found the reason and solution for this error.

The Reason: If you have installed IIS AFTER installing .NET Framework 4 (in my case) then it won’t get register with IIS and so when you run the app that is built on .NET v.4  by deploying it won’t work and will give you above mentioned error. And the solution is next.

Categories
.NET ASP.NET Software Tips Visual Studio Windows

ASP.NET and Page Not Found Error while debugging !

Being sunny weekend today, with full of energy I began to work on making some prototype application which I have to present to my client sometimes during next week. It been a while since I worked on ASP.NET on my application (@ 2 weeks) since I installed Sharepoint Server 2010 demo in my machine. So, with having no idea of a monster under the bed, I made a simple web app and fired it up to debug … and with my little surprise, I got really weird “Page Not Found” error !!! To be honest, I have not seen this error before until today. And I had no idea that what went wrong with it. But I thought that may be it is because something is blocking up my access of application to web server. I checked with my new firewall software (Online Armor) which I had installed few weeks ago for testing purposes (yah, I love testing everything … smile_wink) …