views:

431

answers:

1

We have Visual Studio 2005.

I can successfully run MSIL programs from the command line using "ilasm".

I would like to be able to run these inside VS.

From other posts and searches, I gather you need to create a "Console Application" type of project? (They allude to the fact that VS can handle MSIL but I can't find any specific "how to".)

"Console Application" gives the standard Program.cs

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

    namespace AddNumbers
    {
        class Program
        {
            static void Main(string[] args)
            {

            }
        }
    }

I then add my .il file (which adds two numbers) to the project. The project builds successfully and when I run it it does nothing and the breakpoints that I set in the .il file are not triggered. Not surprising because the .il file is not being called.

Can some please provide a step-by-step approach to getting this to work?

I'd also like to know what namespace I need to add to the .il file and also if it is possible to pass parameters to the .il file and (if so) how?

A: 

You would need some kind of ILASM MSBuild task. I am pretty sure someone has made one. :)

You would need to enable the line numbers and debugging options for ILASM.

And here is a complete example, courtesy of MSDN.

leppie