Questions tagged [assemblybuilder]

.NET framework container for building an assembly from one or more virtual paths within an ASP.NET project.

10 questions
12
votes
4 answers

Dynamically created class to cs file?

I am creating a complex class with AssemblyBuilder that Im later creating objects from. There is however uncertainties in how this class is really contructed. So is there any way to write this dynamicly created class to a cs file for inspection? I…
Banshee
  • 15,376
  • 38
  • 128
  • 219
12
votes
1 answer

Wrong file path and line number in Exception stack traces from dynamic code

We are using System.Reflection.Emit to generate code at runtime from source code (yes - as in a compiler). We provide correct symbol information to the ILGenerator with MarkSequencePoint etc, and enable all debug flags on the AssemblyBuilder. The…
Duckers
  • 140
  • 6
2
votes
1 answer

Reflection | Emit | Dynamic Resource Generation - Added resource values using IResourceWriter.AddResource(key,value) cannot read

I am trying to generate an assembly file with some resources. I am using System.Reflection.Emit.ModuleBuilder to define resources. AssemblyBuilder save assembly without giving any errors but when I am trying read resources, ResourceManager doesn't…
Sampath
  • 1,173
  • 18
  • 29
1
vote
0 answers

Building complete Assembly with AssemblyBuilder

When Building a dynamic Assembly with AssemblyBuilder you can create several TypeBuilder instances, and build your type with TypeBuilder.CreateType(). When I have 10 types in my assembly do I have to call this one by one ? Or is there a way to say…
Holger
  • 2,446
  • 1
  • 14
  • 13
1
vote
2 answers

Does EnumBuilder always create enum which are not CLS-Compliant ? How to make the enum CLS compliant?

Below code sample generates TempAssembly.dll with an enum Elevation in it. public static void Main() { AppDomain currentDomain = AppDomain.CurrentDomain; AssemblyName aName = new AssemblyName("TempAssembly"); …
Vaibhav
  • 25
  • 4
1
vote
1 answer

Creating a DLL dynamically the FileVersion doesn't work

I am building a DLL Dynamically and writing the FileVersion doesn't work. The code I'm using is from this Microsoft link and I am expecting the EXE/DLL version to be…
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
0
votes
1 answer

how to define List as a property of Type by using AssemblyBuilder and TypeBuilder in dotnet Core 7?

I'm trying to crate Dymamic Dll by using dotnet 7 Reflection.Emit . I would like to create an Assembly which has a list of string (or Class Type) propery like below ; private List Items; // OR private List Items; And This is the…
ilhan
  • 71
  • 1
  • 5
0
votes
1 answer

Using EnumBuilder in C#

I am using EnumBuilder like described in https://stackoverflow.com/a/792332/910502 to create an enum based on values of a database and like'd to use this approach on a non-developer machine - I can deploy a dummy assembly, but have no post-build…
Llarian
  • 71
  • 2
  • 11
0
votes
1 answer

Removing type from a dynamic assembly

I created a new type using AssemblyBuilder / ModuleBuilder / TypeBuilder. Is there a way to remove this type at a later time from the same runtime?
pmohandas
  • 3,669
  • 2
  • 23
  • 25
-4
votes
1 answer

creating anymous type. type mytpe = typeof(nothing);?

i read here how to create anonymous types at runtime in c# AssemblyBuilder dynamicAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("MyDynamicAssembly"), AssemblyBuilderAccess.Run); string propertyName = "prp_1"; //Type…
bh_earth0
  • 2,537
  • 22
  • 24