Skip to content

Instantly share code, notes, and snippets.

@mhoyer
Created May 14, 2011 07:27
Show Gist options
  • Save mhoyer/972015 to your computer and use it in GitHub Desktop.
Save mhoyer/972015 to your computer and use it in GitHub Desktop.
Silverlight to "classic" .NET assembly converter
SET ILDASM=C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ildasm.exe
SET ILASM=C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe
mkdir $(TargetDir).net
"%ILDASM%" "$(TargetPath)" /out:"$(TargetDir)$(TargetName).il"
sed -i "s/7C EC 85 D7 BE A7 79 8E/B7 7A 5C 56 19 34 E0 89/" "$(TargetDir)$(TargetName).il"
sed -i "s/ \.ver 2:0:5:0/ .ver 2:0:0:0/" "$(TargetDir)$(TargetName).il"
del "$(TargetDir)sed??????"
"%ILASM%" "$(TargetDir)$(TargetName).il" /dll /resource:"$(TargetDir)$(TargetName).res" /out:"$(TargetDir).net\$(TargetName).dll"
@mhoyer
Copy link
Author

mhoyer commented May 14, 2011

By now there is no real testing framework for Silverlight available. After reading this nice article from David Betz, one can think of simply converting plain Silverlight POCO class libraries to classic .NET libraries and run the converted ones against common testing frameworks.

Requirementes

sed (known from ?nix) is required to replace assembly bindings in IL code. Simply download binaries.zip and dependencies.zip from http://bit.ly/4thAhR and move the .exe and .dll files to a location in %PATH% environment where Visual Studio will find it.

Usage

Simply use upper gist in a Visual Studio project for a Silverlight class library as post-build event script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment