How to save a DLL created by the AssemblyBuilder to a specific directory

M

moondaddy

I'm using some sample code from the msdn sample project:
http://download.microsoft.com/downl...echnologies/Reflection/ReflectionEmit.zip.exe

I'm using the 'AssemblyBuilder.Save' method, however, it takes a file name
as a parameter and I dont see any documentaion on how to define the
path/target location to write the file to. Here's a snippet of my code:

Dim TCA As New TestCreateAssembly
Dim [assembly] As AssemblyBuilder
[assembly] = CType(TCA.CreateCallee(Thread.GetDomain(),
AssemblyBuilderAccess.Save).Assembly, AssemblyBuilder)
[assembly].Save("EmittedAssembly.dll")

How do I determin exactly where to write "EmittedAssembly.dll" to?

Thanks.
 
M

moondaddy

Thanks.
I looked through the sample but didn't see where you could specify a
particular directory to save the dll into. I already have code that saves
the dll to disk, but it writes it into the same directory where the other
assembly dlls are. I want to specify a completely different directory which
could be on a different drive.
 
K

Kevin Yu [MSFT]

Hi moondaddy,

The DefineDynamicAssembly method is overloaded. You can specify the path.
For example, you can use the following to create the AssemblyBuilder. The
dll will be written to c:\

Dim a As AssemblyBuilder =
Thread.GetDomain().DefineDynamicAssembly(New AssemblyName("aaa"),
AssemblyBuilderAccess.RunAndSave, "c:\")

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top