Skip to content

Using .net assemblies

serialseb edited this page Apr 28, 2011 · 7 revisions

OpenWrap supports packaging and resolving assemblies for many platforms and framework profiles.

.net Profiles

When OpenWrap needs to resolve dependencies, it starts by detecting which platform and profile is currently in use.

Let's take an example of a .net web application relying on a JSON formatter, compiled for .net 3.5. The package has the following layout:

  • bin-net20
    • Json.Formatter.dll
    • CommonCode.dll
  • bin-net35
    • Json.Formatter.dll

OpenWrap sees that the platform-profile is AnyCPU-net35, and look in order of compatbility. First, it loads all the assemblies in the net35 export. Then, as .net 2 assemblies can be loaded in .net 3.5, that folder is scanned for assemblies. As a Json.Formatter.dll has already been included, there is no need to add that one, so it gets ignored. CommonCode.dll is new, so it gets used.

Supported profiles

Uses: net40 net40cp net35 net35cp net30 net20 sl50 sl40 sl30 sl20 wp70 monotouch20 monodroid20
net40 X X X X X X
net40cp X X X X
net35cp X X X
net30 X X
net20 X
sl50 X X X X
sl40 X X X
sl30 X X
sl20 X
wp70 X
monotouch20 X
monodroid20 X

The silverlight and windows phone profiles are available in OpenWrap 1.1 Note that while monotouch and monodroid are supported in the packaging format, there is no support yet to hook-up the profile value in a monotouch or monodroid project. It would be trivial to add, so if you wish to make this happen, you can track the issue or contribute code.

.net platforms

Another feature supported by OpenWrap, using the same algorithm, is support for swapping assemblies based on the target platform.

The following platforms are currently supported:

  • AnyCPU: Pure MSIL assemblies that can run on any platform
  • x86: Assemblies compiled to target the x86 instruction set, aka 32bit-only assemblies
  • x64: Assemblies compiled as 64bit assemblies
Uses: x86 x64 AnyCPU
x86 X X
x64 X X
AnyCPU X

Unlike Visual Studio, OpenWrap specifically prevents you from referencing platform-specific assemblies from AnyCPU project files, as those configurations will break depending on which platform they are being executed on.