.NET Automation C#.NET

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

Well, nothing much to say, this article is taken from 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.


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

namespace YourNamespace
public partial class RegisterDll : Installer
public RegisterDll()

public override void Commit(System.Collections.IDictionary 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 + "\"");

public override void Install(System.Collections.IDictionary stateSaver)


.NET Automation C#.NET VB.NET/VB

Excel Automation Add-In for Office 64bit Check List

After days of research, hit and trail; today I finally got a working 64bit Excel Automation Add-In. I am using Visual Studio 2010 [.NET 4.0 client profile framework]. 

1. Create a Project using Visual Studio Office 2010 template “Excel 2010 Add-In”. [I opt for this as I need Ribbon UI too, if you don’t need that you can use Class library project as well]

2. Create a New class and follow this article from Eric ( Excel Automation AddIn in Visual studio ). This article covers 95% of stuff you need it to work. Thanks Eric your article is still valid after 3 yrs and new version than those mention there.

3. Make sure you, have a Signed Assembly. I am not sure if it is really true, but when I was manually registering my assembly in failed cases, it warn me to sign them, though it says “registration succeed”.

4. Good thing is I am creating Add-IN using 32bit machine, and even though my addin works for 64bit. I do not define any specific CPU, just use ANYCPU flag where applicable.

5. Make sure you do not check “Make COM Visible” under Advance setting of your Assembly properties. Again I am not sure, if it is true, but it works when I have it OFF.

6. Do not check “Register for COM” under the BUILD Tab of Project property in Visual Studio. We need to manually register using 64bit regasm through our Setup or command line as you like.

7. [Guess not important or relevant], I have by default Sign for ClickOnce mainfest enable. Actually it is enable for Template project by Visual studio. I keep it that way, doesn’t harm to have it.

8. Make sure to create a good GUID for Class definition as define in article. There is another GUID used in Assembly information, I try to match them and it didn’t work. When it works they have different GUID. Though have it same or different should make difference according to me.

9. I define a ProgID on top of my class like

public class Sound



I guess that is all what I make changes and have it working. Best of luck.



.NET ASP.NET C#.NET Programming

Sandcastle: Code Documentation in C#

Over the years I use lot of documentation and those help me build my software with ease. However, never need to build one for my projects as they are not quite often big and what more never need to do so, as they are quite handful of function in complete project. But now in order to upgrade my coding and making it more friendly for my brain. I finally was looking for a decent method to start documenting my code in separate code files much like PHP or MSDN documentation. 

The best was to start with .NET documentation tools as they are more readily available. After searching and trying to make sense what all these tools are good for, I finally reach to Sandcastle. Install it, but found nothing in my start menu. Read about it, seems a command line tool. But I need GUI, been a lazy programmer. Well I got the answer in term of Sandcastle Help File Builder on Codeplex ( . Looks promising, I install it. And within 3 minute of installation, my documentation is ready. How?

Simple. I open the software, Add Documentation Source as my project SLN file, click build and it create file for me. I need nothing else. There maybe lot of configuration to do, but for first time, it is more than enough. I have been commeting my code day I start programming. And from about a year or so, I start using those /// commenting as in XML generation tool within Visual Studio. But never compile them in help file. 

Now I know easiest method to do. i.e. open Builder GUI, click build [For second time of course]. I will keep generating lot of help file so I can check them back when needed in future. Changing my programming style when nobody is there to talk or see face to face is enjoyable. Me and my computer sitting alone and doing lot of new learning. Going back to days of programmer is really good to continue my learning process that I left 4 years ago.

I am still good and hope to improve further.

.NET ASP.NET Blog: My thoughts C#.NET Joyous

Working Lot of new methodology

It is good to back as programmer. Loving my new phase of development career, I got involved in development of a online card game. After lot of thinking and reading, I decide to use some new technology and methodology which I have been hearing about a lot. I don’t dare to use them as I feel the kind of project we were doing lately are not big enough to learn and implement those concepts. After for this project it really become necessity to these technology rather than just a decision making. For example to build a game UI, I have three option GDI+, DirectX or WPF.. I have done GDI+ before and doesn’t feel it is best to make complex Graphical interface even for like of poker game. Though I use it to build Chess Interface, but I know how problematic it was. Second came in DirectX, the best but the complex solution. I need more time to learn it and project is getting delayed. Then I choose to learn and work on WPF which is relatively easier than DirectX.

It was really a nice decision to choose WPF. It is not only easier for me to learn as I already have some experience in HTML and web programming, but it give me control which is best suited for programmer of my culture. With no efforts I am now able to create a better looking UI. Ofcourse I didn’t test the UI on Windowx XP yet, but otherwise it looks great. I am not going to test it on Windows XP anyways as we don’t going to support it. Once I have the UI ready. I need to now communicate with Online database. So for this I already know the solution called as Web Services. But where will I found the Web Service in Visual Studio 2010 .. oh I think they rename it as WCF.. nope, they make a new concept altogether called WCF. Hmm.. with past experience of webservice I know that it was the perfect solution for me, but again WCF is almost similar no difference to code, so what harm it does to use it. Afterall it bring some new security measure and ease. So I again learn WCF and it took me 1 hr to cover the difference between Web Service and WCF and I am up and ready with my solution.

Making game UI is really so exciting that I am now looking for opportunity to upgrade my Chess game to WPF interface. Programming is really fun with those concept of programming and tools that I learn in recent past. It was complex then before in planning, but easy to implement. However the attitude of programmer is they need something ease to plan and implementation they are not bothered. I must suggest using WPF and WCF in your project where you need them. I haven’t try but they says WPF and Silverlight has same code or reusable. Well if that is the case then surely I will start giving Silverlight solution in next quarter or so.