Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:09:34+00:00 2026-05-23T20:09:34+00:00

I am working on a tool to generate assemblies for WP7. I am doing

  • 0

I am working on a tool to generate assemblies for WP7. I am doing this from the full framework. Since Reflection.Emit doesn’t work with WP7 but either CCI or Mono.Cecil do I am wondering if there is a way to create new assemblies from scratch. I already know that I can modify existing assemblies, but being able to create one would be pretty useful.
I guess a workaround would be to generate an empty assembly in visual studio and keep it as a template, but I think that there should be a better way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:09:36+00:00Added an answer on May 23, 2026 at 8:09 pm

    It’s pretty easy to do with Mono.Cecil:

    using Mono.Cecil;
    using Mono.Cecil.Cil;
    
    class Demo
    {
    
        static void Main()
        {
            var winphoneAssemblies = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone";
    
            var assemblyResolver = new DefaultAssemblyResolver();
            assemblyResolver.AddSearchDirectory(winphoneAssemblies);
    
            var winphoneCorlib = assemblyResolver.Resolve("mscorlib");
    
            var module = ModuleDefinition.CreateModule("Test", new ModuleParameters
            {
                AssemblyResolver = assemblyResolver,
                Runtime = TargetRuntime.Net_2_0,
                Kind = ModuleKind.Dll,
            });
    
            // trick to force the module to pick the winphone corlib
            module.Import(winphoneCorlib.MainModule.GetType("System.Object"));
    
            var type = new TypeDefinition("Test", "Type", TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Abstract, module.TypeSystem.Object);
            module.Types.Add(type);
    
            var method = new MethodDefinition("Identity", MethodAttributes.Public | MethodAttributes.Static, module.TypeSystem.Int32);
            method.Parameters.Add(new ParameterDefinition("i", ParameterAttributes.None, module.TypeSystem.Int32));
    
            type.Methods.Add(method);
    
            var il = method.Body.GetILProcessor();
            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Ret);
    
            module.Write("Test.dll");
        }
    }
    

    A few things to note:

    • The need to create the module with an assembly resolver targeting the winphone assemblies.
    • A little trick to make sure the module picks up the proper winphone mscorlib (will be fixed in the next version of Cecil).
    • Silverlight assemblies have the metadata version of the .net 2.0 framework.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a tool that will generate the source code for an interface
Is there any good tool for working on Dabtabase apart from Toad which requires
I'm working on a internal web based tool for my company. Part of this
I'm working on building a development tool that is written in JavaScript. This will
We are working on custom ETL tool. We extract data from database in files,
I'm working on a a tool to generate TSV files for import into a
Is there a tool that works with SQL Server to generate tree-like diagrams from
I am working on tool to optimize linq to sql queries. Basically it intercepts
I am working on a tool where I need to convert string values to
I'm working on a tool to simplify an application's deployment. Hence I'm aiming to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.