Building the DLR/IronPhython for Silverlight 4

Apr 27, 2010 at 11:26 PM

Having encountered some weird compiler errors relating to Microsoft.Dynamic for the first time today, I decided to rebuild the DLR and Iron Python from the version 1 sources for Silverlight 4.  To do this I created a new solution and added in all the required projects, set the SilverlightPath environment variable and after a while I managed to get it to build.

However, when initializing the Iron Python engine, I get this exception:

Could not load file or assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

On this line:

[MultiRuntimeAware]

<font face="Consolas" size="2">

 

</font>
private static readonly Dictionary<Type/*!*/, ExtensionTypeInfo/*!*/>/*!*/ _sysTypes = MakeSystemTypes();
 

 

Has anyone actually got this to work with Silverlight 4?

As far as I can tell, it should be compiling correctly, based on my understanding of the .csproj file, but in reflector, it is clearly using the incorrect version:

// Assembly Reference System.Numerics
Version: 4.0.0.0
Name: System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Does anyone have a solution so I can get back to working?

...Stefan

Apr 27, 2010 at 11:40 PM
System.Numerics.dll is a runtime dependency as well, so it is required to be in your XAP to use IronPython built against Silverlight 4. So add it as a reference to your project (it's In the Silverlight 4 SDK), and you should be good to go.

And yes, I'm building IronPython against SL4 all the time, so it does work. However, as we haven't released SL4 binaries yet, you might hit some intrastructure-related build issues.

~Jimmy

>
Apr 28, 2010 at 12:08 AM

Part of the problem is that in the project the reference is like this:

<Reference Include="System.Numerics, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(SilverlightPath)\System.Numerics.dll</HintPath>
    </Reference>

And SilverlightPath is set as:

C:\Program Files (x86)\Microsoft Silverlight\4.0.50401.0

but the file doesn't exist there, it exists here:

c:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\

if I explicitly reference this in all 3 projects that need it, it works.

...Stefan

Apr 28, 2010 at 12:10 AM
jimmysch wrote:
System.Numerics.dll is a runtime dependency as well, so it is required to be in your XAP to use IronPython built against Silverlight 4. So add it as a reference to your project (it's In the Silverlight 4 SDK), and you should be good to go.

And yes, I'm building IronPython against SL4 all the time, so it does work. However, as we haven't released SL4 binaries yet, you might hit some intrastructure-related build issues.

~Jimmy

>

 Jimmy,

Yes that is exactly the problem, System.numerics as part of the SDK and the structure of the projects expects it to be under the Silverlight 4 binaries path. Once I corrected that, it seems to work.

...Stefan

Apr 28, 2010 at 12:48 AM

AH, I get it. Because System.Numerics.dll doesn't exist in the Silverlight runtime, it's failing to compile. We should use $(SilverlightSdkPath) for System.Numerics.dll's references instead. This works for me because we have the Silverlight binaries checked into our internal source tree, and we've just dropped System.Numerics.dll there as well.

Apr 28, 2010 at 12:50 AM

I've opened this IronPython bug to make sure this happens:

http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26901

May 7, 2010 at 10:31 PM

FYI, here's a build to unblock you: http://jimmy.schementi.com/downloads/ipy-sl4-20100507.zip