all groups > dotnet clr > july 2003 >
You're in the

dotnet clr

group:

Reflection - Saving an assembly in ASP.NET



Reflection - Saving an assembly in ASP.NET Don King
7/3/2003 1:54:47 PM
dotnet clr: I am trying to save an assembly in the bin folder of an ASP.NET application
using the AssemblyBuilder.Save() method. But when I call the save method,
and specify the file name, it saves in the C:\Windows\System32 directory.
The method does not allow you to specify the path (throws an exception).
Does anyone know what the problem might be? Thanks for any help.

Don

Re: Reflection - Saving an assembly in ASP.NET Ken
7/4/2003 5:03:55 PM
Before you define dynamic assembly, set AssemblyName.CodeBase like
myAssemblyName.CodeBase = [String].Concat("file:///",
Directory.GetCurrentDirectory );
--
ken@occultsoft.com
File, Disk tools -- http://www.occultsoft.com/

Re: Reflection - Saving an assembly in ASP.NET Donald King
7/6/2003 7:08:07 PM
Ken - Thanks for the reply. Unfortunately the code you provided returns
Windows\System32 as the current directory. It seems that the CodeBase
property is ignored anyway so I don't know if it matters. I used
Server.MapPath and it returns the web directory as intended but when I set
the CodeBase property using that path it just goes ahead and saves where it
wants. I am beginning to think that I may need look at the user that the
web is running under. Thanks again and any other thoughts or suggestions
you might have are welcomed and appreciated.

Don

[quoted text, click to view]

Re: Reflection - Saving an assembly in ASP.NET Donald King
7/6/2003 9:34:55 PM
I found the solution to this problem in case anyone is interested. The
method DefineDynamicAssembly is overloaded. That was a simple one that I
shouldn't have missed.

Overloads Public Overridable Function DefineDynamicAssembly(AssemblyName,
AssemblyBuilderAccess, String) As AssemblyBuilder

Where String is storage directory. In my case I set it to
AppDomain.CurrentDomain.BaseDirectory & "bin/"

Don

AddThis Social Bookmark Button