By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,992 Members | 934 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,992 IT Pros & Developers. It's quick & easy.

About Dynamic Code Generation

P: n/a
Hi all,

I am facing a problem in dynamic code generation at run time, the problem
occurs when the dynmaic code use global data exist within the original
application.
Lets say that my application is called "Dynamic Code", so the name space in
my project is "Dynamic Code", I have created "Form1.cs" where my code exist.
Form1 class contain a global class "xarray" with static memeber "x" which is
an array, I want the added dynamic code by the end user to use this array.

I have included "using DynmaicCode;" in the generated dynamic code, in the
assembly references added to the compiler parameters I have written the
Following code:

param.ReferencedAssemblies.Add("Form1.dll"); // param is the copiler
parameters object.

to enable the use of array x in the dynamic code, the above code is written
in Form1.cs, the problem is when compiling the added code the compiler give
me an error that Form1.dll does not found, What shall I do to enable the use
of Global data within the project by the run timr added code???

waiting a reply plz.

Ghada

--
Message posted via http://www.dotnetmonster.com

Aug 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Exactly what error is being generated? Does it say

error CS0006: Metadata file 'Form1.dll' could not be found

or something else? Are you referring to a CompilerResults.Errors
entry or a thrown exception? Are all your dll's in the same directory
as the running executable? If not then you'll need to use fully
qualified paths to all dll's.

HTH,

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Mon, 21 Aug 2006 14:09:38 GMT, "Ghada Al-Mashaqbeh via
DotNetMonster.com" <u7793@uwewrote:
>Hi all,

I am facing a problem in dynamic code generation at run time, the problem
occurs when the dynmaic code use global data exist within the original
application.
Lets say that my application is called "Dynamic Code", so the name space in
my project is "Dynamic Code", I have created "Form1.cs" where my code exist.
Form1 class contain a global class "xarray" with static memeber "x" which is
an array, I want the added dynamic code by the end user to use this array.

I have included "using DynmaicCode;" in the generated dynamic code, in the
assembly references added to the compiler parameters I have written the
Following code:

param.ReferencedAssemblies.Add("Form1.dll"); // param is the copiler
parameters object.

to enable the use of array x in the dynamic code, the above code is written
in Form1.cs, the problem is when compiling the added code the compiler give
me an error that Form1.dll does not found, What shall I do to enable the use
of Global data within the project by the run timr added code???

waiting a reply plz.

Ghada
Aug 21 '06 #2

P: n/a
Ghada Al-Mashaqbeh via DotNetMonster.com wrote:
I am facing a problem in dynamic code generation at run time, the problem
occurs when the dynmaic code use global data exist within the original
application.
Lets say that my application is called "Dynamic Code", so the name space in
my project is "Dynamic Code", I have created "Form1.cs" where my code exist.
Form1 class contain a global class "xarray" with static memeber "x" which is
an array, I want the added dynamic code by the end user to use this array.

I have included "using DynmaicCode;" in the generated dynamic code, in the
assembly references added to the compiler parameters I have written the
Following code:

param.ReferencedAssemblies.Add("Form1.dll"); // param is the copiler
parameters object.

to enable the use of array x in the dynamic code, the above code is written
in Form1.cs, the problem is when compiling the added code the compiler give
me an error that Form1.dll does not found, What shall I do to enable the use
of Global data within the project by the run timr added code???
You can try:

param.ReferencedAssemblies.Add(System.Reflection.A ssembly.GetExecutingAssembly().Location);

which include full path to the call assembly.

Arne
Aug 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.