Categories
.NET Automation C#.NET

Regasm 64bit or 32bit through Windows Installer in Visual Studio

Well, nothing much to say, this article is taken fromĀ http://leon.mvps.org/DotNet/RegasmInstaller.html. Thanks Leon, just for my own bookmarking here are step. [Article is taken as it is from Leon’s article.]

Realising that I couldn’t be the only person who’s having this problem, I’ve decided to share the code to assist others. All you need to do is follow the below steps:

  • In your main project (the one containing the class you want to register), right click the project file and select Add / New Item and select Installer Class. Call it something like clsRegisterDll.cs
  • In the designer that appears, click ‘Click here to switch to code view’ or right click the clsRegisterDll.cs file in solution explorer and select View Code
  • Replace the code in the window with the code listed below, and make sure you change ‘YourNamespace’. This has to match with the namespace in the clsRegisterDll.Designer.cs file.
  • Compile your project
  • In your installer, make sure you have added your dll to the Application Folder, and then right-click the installer project and select View / Custom Actions
  • Right-click Install, and then click Add Custom Action
  • Double click on Application Folder, and then on your dll
  • Do the same for the Commit action
  • Build and test your installer
  • You should now have an installer that registers your dll using regasm /codebase.

clsRegisterDll.cs:

using System.ComponentModel;
using System.Configuration.Install;

namespace YourNamespace
{
[RunInstaller(true)]
public partial class RegisterDll : Installer
{
public RegisterDll()
{
InitializeComponent();
}

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);

// Get the location of regasm
string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + @"regasm.exe";
// Get the location of our DLL
string componentPath = typeof(RegisterDll).Assembly.Location;
// Execute regasm
System.Diagnostics.Process.Start(regasmPath, "/codebase \"" + componentPath + "\"");
}

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
}
}

 

Categories
Article Blog: My thoughts Concept/algorithm Programming

MVC : First Encounter

I have been reading about upcoming of MVC from quite few years, but I never feel the need of it. It is surprisingly but yes, I never feel of MVC in web development. I have created my own coding pattern which is good for most programming I have seen in my career. But still MVC always seems to attract me. So finally I decide to give it a try. I remember I try it with CodeIgnitor in PHP previously and was not very impressed with idea of MVC as I see it not quite upto the task as anyother framework it tend to load those load of script that are necessary to run MVC and the framework fine. Sometime you never need that many files. But still I was wondering why people look for something in that line? Well you never learn answer of such question unless you try yourself. So, I try it with .NET 4.0, when I got a chance to make a mobile website. I have to make a really small website and I feel it is best for to learn during this website development. I start it out with video tutorial and thanks to Scott Hanselman’s webcast I get my mind clear on MVC concepts in .NET and what is MVC in general.

Though MVC looks promising but I feel it is not probably not very mature or maybe not a good idea for big projects. I feel it little complex to make architecture of application with MVC as compare to transition event driven programming or procedural programming of old PHP. But yes it is way to dynamic and based on naming convection and assumption/concepts. Which make it cool. At first it looks good to me, but my second thought came in, if dynamic binding is that good then why we need Strong Data Type in applications? Why .NET or Java strats like that and why PHP is going for OOPS programming which again become strong data type somewhere? Isn’t it slow to use dynamic binding then to static binding?

MVC is good for Expertise in either programming, designing or database handling. This make it good choice for enterprise software but definiately for a Geek programmer I feel it is not upto the mark. BTW why a geek programmer care about what is buzz in market, he do his job perfect anyways.

I am confused about MVC , I am not sure if I will adopt it in my future programming yet or will wait for something better to come up. Any advice.

Categories
.NET Server Configuration

.NET 4.0 On IIS 6

With my dedicated Windows 2003/IIS 6.0 server I want to run latest version of .NET framework on it. Hence I use my Web Platform Installer to install .NET 4.0. Everything goes smooth. It was piece of cake to install it.

Now the time came to run my first .NET 4.0 Framework application, I configure a New website in IIS. Select .NET framework 4.0 from ASP.NET tab in Website property. But what I found is I am getting 404 error. Strangely enough that Default.aspx page does exists and with .NET 2.0 it works just fine. So what goes wrong ? I search and experiment with web.config, but to no avail.

Then I found this article http://www.denalimultimedia.com/info/Articles.aspx?cid=20&topic=IIS-6-ASP-NET-4-0-page-not-found-404, which clearly mention that

  • Install framework asp.net 4.0 and restart [Web Platform Installer does it just fine]
  • IIS 6.0 console should now display ASP.NET 4.0 under tab “ASP.NET” [It was again done if #1 above is right]
  • Under Web Services Extensions (in IIS console) .NET 4.0 framework might be set as: prohibited. This must be ALLOWED otherwise a browser might just return the error 404 page not found which is not very descriptive
  • ASP.NET 4.0 applications must be run in a separate process (Application Pool) otherwise you’ll get the error ‘Server Application Unavailable’.

It is anyways always good to run different programming languages in different pool. For Example, if you want to run PHP on same server I use different pool for them. Covering those 4 steps I got my server working with .NET 4.0. Wondering why Web Platform Team forgot to complete 2 step in their installer.