Howto: Build and Debug IPY Studio from source

Jan 17, 2008 at 4:33 AM
Here are the basic steps I used to get Visual Studio 2008 and the Iron Python Studio source synced up.
The goal here is to build the source and run Iron Python Studio under the Visual Studio 2008 debugger.

Prerequisites:

  1. Visual Studio 2008
  2. Visual Studio 2008 SDK
  3. Iron Python Studio (this is optional since it contains two missing files not currently in source control).
  4. Iron Python Studio source...

Steps

  1. If desired, locate the missing files listed below and copy them to '\Trunk\Source\IronPython\IronPythonProject\Resources\'. Otherwise, remove all references to them in IronPythonProject\Resources.resx.
    1. C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Samples\IronPythonIntegration\Project\Resources\PythonSplashScreenIcon.bmp
    2. C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Samples\IronPythonIntegration\Project\Resources\PythonAboutBox.ico
  2. Open the Iron Python Studio solution file ( \Trunk\Source\IronPythonStudio.sln )
  3. Load the properties dialog for the IronPythonLangaugeService project. This is the 'Start Up Project' in bold text.
  4. Click the 'Debug' tab on the properties dialog and set the following:
    1. Change the 'Start Action' to 'Start External Program' and enter 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe'
    2. Under 'Start Options' set the 'Command line arguments:' field to '/ranu /rootsuffix Exp' . This loads the environment in the 'Experimental' hive, which prevents the desctruction of a working setup and allows for easy cleanup (Programs->Visual Studio 2008 SDK->Tools->Reset the Microsoft Visual Studio 2008 Experimental hive).
    3. Tidbet - /ranu is an acronym for Run as Normal User.
  5. Set a breakpoint on the constructor of Microsoft.Samples.VisualStudio.IronPythonLanguageService.PythonPackage. We'll use this to verify a proper configuration.
  6. Now we can build and debug the Solution (F5 works well). This will take a while as it sets up the new environment, however, subsequent builds will be much quicker. When complete, a new instance of Iron Python Studio starts.
  7. Once Iron Python Studio opens you'll notice the breakpoint is not immediately hit. This is because PythonPackage is loaded on demand, as needed. To trigger the loading of PythonPackage() create a new Iron Python project of any type and wait for the subsequent breakpoint stoppage.
Jan 24, 2008 at 3:46 PM
To compile IronPython Studio in Visual Studio 2008, I had to make two changes. Once done, everything compiled ok.

First, I had to do Step 1 above (copy PythonSplashScreenIcon.bmp to source tree).

Second, I had to update two Dlls from 2008 SDK to 2005 SDK as described below (thanks to Ed Dore for posting a solution):

2.4 Microsoft.VisualStudio.Shell.Interop.8.0.dll and Microsoft.VisualStudio.Shell.8.0.dll from the Visual Studio 2005 SDK requires needs to be updated

If you are installing the Visual Studio 2008 SDK on a computer that has the Visual Studio 2005 SDK installed, you should update the Microsoft.VisualStudio.Shell.Interop.8.0.dll and Microsoft.VisualStudio.Shell.8.0.dll in the VS2005 SDK. Some changes were made to this file during the Visual Studio 2008 time frame and to benefit from these changes, you will have to manually update this file. To do so, copy the Microsoft.VisualStudio.Shell.Interop.8.0.dll and Microsoft.VisualStudio.Shell.8.0.dll from:

\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\Assemblies\
and overwrite the copy under
\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Common\Assemblies\

If these assemblies are not updated, some warnings may be displayed when building packages that reference this dll. They would look like:

Reference to type 'Microsoft.VisualStudio.Shell.IOleMenuCommand' claims it is defined in ‘\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll', but it could not be found
Jan 30, 2008 at 3:09 PM
kpullin:

Is this also possible for you to generate an IpyStudio executable for alpha Ipy 2 with your solution? I do not have (and no possiblities to have) many of the tools that let generate IpyStudio executable for Ipy 2.0

What I could do is to run IpyStudio with the new Ipy productive version 1.1.1, I only replaced the .dlls of Ironmath and ironpython.

Regards.
Feb 3, 2008 at 10:15 PM
oldman,

I haven't tried to run IPyStudio with Iron Python 2.0.
I have however looked into doing this and am not sure if it will work.

At this point that IPy2.0 does not yet generate valid executable assemblies (meaning the items generated via -X:SaveAssemblies are invalid) and I don't know enough about the context under which code runs to determine if this is required.

If IronPython studio generates these assemblies and then executes the result, then this will not work. If instead the code is dynamically compiled by the IronPython Studio host then it is possible. My guess is that the former case is true, but will gladly accept being proved wrong!