Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Silverlight: reference to wrong version of system.dll

Received: by 10.224.203.133 with SMTP id fi5mr6973198qab.8.1330899934640;
        Sun, 04 Mar 2012 14:25:34 -0800 (PST)
X-BeenThere: mono-cecil@googlegroups.com
Received: by 10.229.241.210 with SMTP id lf18ls5271328qcb.6.gmail; Sun, 04 Mar
 2012 14:25:32 -0800 (PST)
Received: by 10.224.196.196 with SMTP id eh4mr6968444qab.5.1330899932911;
        Sun, 04 Mar 2012 14:25:32 -0800 (PST)
Received: by 10.224.205.74 with SMTP id fp10msqab;
        Sun, 4 Mar 2012 14:19:11 -0800 (PST)
MIME-Version: 1.0
Received: by 10.52.27.178 with SMTP id u18mr503629vdg.16.1330899550961; Sun,
 04 Mar 2012 14:19:10 -0800 (PST)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
 eina...@gmail.com designates internal as permitted sender)
 smtp.mail=eina...@gmail.com; dkim=pass
 header...@gmail.com
Received: by l7g2000vbw.googlegroups.com with HTTP; Sun, 4 Mar 2012 14:19:10
 -0800 (PST)
Date: Sun, 4 Mar 2012 14:19:10 -0800 (PST)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2)
 Gecko/20100101 Firefox/10.0.2,gzip(gfe)
Message-ID: <66a18a99-fefa-47d5-9107-d0a4626133ea@l7g2000vbw.googlegroups.com>
Subject: Silverlight: reference to wrong version of system.dll
From: einarwh <eina...@gmail.com>
To: mono-cecil <mono-cecil@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I'm a Mono.Cecil n00b trying to do some IL rewriting on Silverlight
assemblies, but I seem to be doing something wrong. The "tampered"
assemblies (after rewriting) look OK in ILSpy, except for the
references to .NET framework libraries, which include the
standard .NET v 4.0 (not Silverlight) of system.dll and mscorlib.dll.
I guess I must be doing something wrong when I'm importing types? I
tried to follow the recipe here:
http://stackoverflow.com/questions/9109506/mono-cecil-fails-to-process-a-silverlight-5-assembly
so I use the following code to read the assembly:

var resolver = new DefaultAssemblyResolver();
resolver.AddSearchDirectory(@"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\Silverlight\v4.0");
var assembly = AssemblyDefinition.ReadAssembly(
     assemblyPath,
     new ReaderParameters { AssemblyResolver = resolver });

I still seem to have the same problem, though. How do I best debug
this? How can I spot that I've inserted a faulty reference to the
regular .NET v4 dlls? I'm trying to inspect the
TypeReference.Module.Runtime and TypeDefinition.Module.Runtime of the
various types I use, does that make sense?

Any help would be greatly appreciated.

Kind regards,