Tag Archives: Visual Studio

Bring Python to Your .NET Development with IronPython

Python is a high-level programming language that has gained popularity in recent years for its emphasis on clear code that is easy to read, combined with surprising power and flexibility. Because Python is free and open-source, it has become a widely used scripting language primarily for web-based applications…but did you know that a little help from the .NET framework can bring your Python apps to the desktop, complete with a graphical user interface? IronPython is a handy tool that will allow you to enjoy the perks of .NET development with your favorite language, Python.

IronPython is a version of Python that is tightly integrated with .NET, originally developed and maintained by a team of Microsoft engineers but recently released to the open-source community. IronPython integrates with Microsoft Visual Studio and allows you to combine traditional Python code with .NET technologies, including Windows Forms and WPF for UI design. The result is a Python-coded application that looks and behaves no differently than any other Windows program, which is a big improvement over the command-line programs typical of the language.

'Hello World' with IronPython

But how exactly does IronPython fit into the .NET world? The diagram below shows the basic functionality where the Python code makes calls to both the .NET framework classes as well as Python libraries. The Python code is then compiled by the IronPython Engine and converted to assembly code that can be executed by the .NET runtime.

IronPython isn’t just for the desktop and can be used to develop web applications that integrate with Silverlight, a Microsoft framework similar to Adobe Flash. If you’re worried about pigeon-holing yourself into Windows with .NET, fear not, IronPython is supported by Mono, an open-source and cross-platform alternative to .NET. Likewise, if you don’t have the money to throw down on a license for Visual Studio, IronPython Studio is a free IDE that runs from the Visual Studio Shell.

So, if you’re a Python developer and want to make user-friendly apps that can take advantage of all that .NET has to offer, bust out of your command-line world give IronPython a spin.

How to install Microsoft’s FxCop for Visual Studio 2010

I recently discovered Visual Studio Achievements, which as the name indicates, adds video game-style “achievements” to Microsoft’s premiere IDE while you code. Visual Studio Achievements was even created by Microsoft’s Channel9 team, so you know it’s the real deal.

Some of the unlockable achievements include positive awards like “Add 10 regions to a class. Your code is so readable, if I only didn’t have to keep collapsing and expanding!” and negative awards such as “Write a single line of code at least 300 characters long. Who needs carriage returns?”. With leaderboards and fun icons, Visual Studio Achievements adds a little fun to your programming experience.

Many of the achievements require a Microsoft tool called FxCop to be installed for them to be unlocked. FxCop is a utility that can analyze your source code and provides feedback on possible design, localization, performance and security improvements. Unfortunately, if you head to the FxCop download page, you’ll quickly learn than the FxCop “download” is actually a text file that tells you to install another file to actually get the application.

When you open the FxCop text file, you’ll be presented with the following information.

FxCop Installation Instructions
1. Download the Microsoft Windows SDK for Windows 7 and .NET Framework 4 version 7.1.
2. Run %ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\FXCop\FxCopSetup.exe to install FxCop.

I know, I was surprised too. For this to work, I need to install the Windows SDK, then install another installer? Well you’re in luck – I took the time to figure out what files were needed so you can install FxCop as quickly as possible. Just follow my instructions below.

Note: This guide is only required if you are using Visual Studio 2010 Professional. If you have Visual Studio 2010 Premium or Ultimate installed, FxCop will already be included with your IDE.

How to install FxCop

Step 1. Download the Microsoft Windows SDK installer.

Step 2. Run the installer. Click “Next” until you get to the “Installation Options” screen.

Step 3. In the Installation Options screen, select only “Tools” under the .NET Development section. You’re free to install other features as well, but “Tools” is the only item that will include the FxCop installer.


Step 4. Click “Next” and continue following instructions until installation is complete.

Step 5. After the installer finishes, navigate to C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\FXCop.

Run the installer in that folder, FxCopSetup.exe.

After installing FxCop, you’re finished! You can now enjoy the full features of both FxCop and Visual Studio Achievements.