Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

IL Support Extension v2.0

Today's Visual Studio extension is one that is for those who say Managed Languages are for wimps, that real dev's program directly in IL (Intermediate Language)!

Okay maybe that's a little over-the-top. Still this project and Visual Studio extension is cool on a couple levels. It shows how language features can be added to the IDE and also gives you a cool way to use IL.

IL Support

Provides syntax highlighting for the IL (Intermediate Language) and project templates for C#, F# and Visual Basic that support embedding and calling IL code.

image

IL Support 2.0

What's new

  • Support for Visual Studio 2012
  • Support for Portable Class Libraries
  • IL Support is now licensed under the MIT License. See the project page on GitHub.

Syntax Highlighting

IL Support includes a simple syntax highlighter for IL files (.il). It adds 3 configurable custom classifications (Instruction, Directive and Directive (Security)), in addition to using the standard classifications.

Project Templates

IL Support includes multiple project templates that support embedding and calling IL code in addition to another language (C#, F# and Visual Basic). The generated projects have no dependencies and should build on any Visual Studio 2010/2012 installation, even without this extension installed. They support all the project properties and configurations, build incrementally, and even allow breakpoints and debugging step by step in both the main language and the IL.

Every non-empty project contains a simple example showing how to embed IL.

The following projects are included:

  • Visual C#
    • Empty Project with IL Support
    • Class Library with IL Support
    • Portable Class Library with IL Support
    • Console Application with IL Support
    • Windows Forms Application with IL Support
    • WPF Application with IL Support
  • Visual F#
    • F# Application with IL Support
    • F# Library with IL Support
    • F# Portable Library with IL Support
  • Visual Basic
    • Empty Project with IL Support
    • Class Library with IL Support
    • Portable Class Library with IL Support
    • Console Application with IL Support
    • Windows Forms Application with IL Support
    • WPF Application with IL Support

ins0mniaque/ILSupport

...

Modifying your own projects to allow IL embedding

  1. Edit your project file and insert this before the following section (which should be at the end)

    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> -->

  2. You're done! Create a new project with IL Support if you need an example of how to embed IL.

How does it work ?

The project modification adds 5 simple steps :

    1. Hide IL files from the compiler
    2. Let the project compile
    3. Decompile the resulting assembly into IL
    4. Comment out all methods that were marked with the forwardref method implementation option
  1. Recompile the commented out IL with all the other IL files

The source is available, so you can see exactly how it works. Another possibility, for example, is to fork it and update it to provide VS 2013 support (like here).

 



Tags:

Follow the Discussion

  • Is there IL deassembly feature that allows to easily see the IL of a method in VS?

  • Stilgar - You do already have ILDasm.exe on your computer that can show you IL from any assembly (that hasn't been marked as "don't disassemble"). If you're asking specifically about doing that from within VS, the best I've ever come up with is to add ILDasm.exe on my Tools menu with Tools/External Tools... you can set that up to automatically open the output assembly of the current project.

  • Yeah I know about ildasm and I use it but I kind of wish that I could right click on a class and see the code in Visual Studio probably with highlighting, goto definition, goto jump label, etc.

  • .NET reflector Visual Studio add-in can decompile to IL within Visual Studio with goto definition etc, expect there are other add-ons that do this as well.

  • Anony MouseAnony Mouse

    ILSpy (http://ilspy.net/), one of my favorite tools for learning .NET internals, is an Open Source alternative to Reflector. Strongly recommended!

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.