473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

CodeDom - Namespace/Class interaction between Ns1 and CodeDom's Ns2

Hello,

I was wondering if anyone might know the easiest way to access static methods through a namespace(MyNamespace) from CodeDom generated code?



Basically I have this in my MyNamespace.Form:

//////// Most of this below is almost useless jargon just to give an idea of what values are set or not
public CodeDom.Compiler.CodeDomProvider provider = new Microsoft.CSharp.CSharpCodeProvider();

public System.CodeDom.Compiler.CompilerParameters parms = new System.CodeDom.Compiler.CompilerParameters();
parms.GenerateExecutable = false;
parms.GenerateInMemory = true;
parms.ReferencedAssemblies.Add("System.dll");

public CodeCompileUnit compileUnit = new CodeCompileUnit();

public CodeNamespace namespacee = new CodeNamespace("CodeDomNamespace");


namespacee.Imports.Add(new CodeNamespaceImport("System"));
namespacee.Imports.Add(new CodeNamespaceImport("MyNamespace"));

///End jargon above, my question below:

Currently in code:

public string code = @"pubilc static string StringTest()
{
return ""the test""
}
";

but I'd like the code string to say this:

public string code = @"public static string StringTest()
{
return MyNamespace.MyClass.MyRoutine("test");
}


And in MyRoutine...

public static string MyRoutine(string s)
{
s = s + "1";
return s;
}


However when I try this, I keep getting an error in my reflection setup:

Could not load file or assembly 'file:///C:\Users\rolo\Appdata\Local\Temp\przvq1_b.dll' or one of its dependencies. The system cannot find the file specified.


I'm pretty new at this, it works fine as long as I don't try modify the string code to use "return MyNamespace.MyClass.MyRoutine("test"); " .

Any ideas on how to do this?
Oct 22 '08 #1
0 1170

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ron Bullman | last post by:
Hi, I havent been able to find any documentation about @ in the CodeDom context. The problem is when generating C# code from CodeDom it will associate a @-tag with all C# specific types. Why?...
0
by: Shawn A. Hall | last post by:
First, I apologize if this isn't the right group to post this question, but I didn't see a newsgroup specific to CodeDom so here I am. On to my question: I am trying to use CodeDom to generate...
5
by: Mark | last post by:
I'm using the CodeDom namespace to generate code. How do you specify that the method of a class should be static? I'm assuming I use the CodeMemberMethod class to define the method, but I'm not...
3
by: Mark | last post by:
I'm looking at the CodeDom namespace in .NET 2.0 class library online (http://msdn2.microsoft.com/library/za6cc751.aspx). I'm not seeing any class that would allow me to create Generics. Any...
4
by: Raja | last post by:
Have both .Net framework 1.1 and Framework 2.0 installed in my machine But, am unable to find out system.codedom.dll in my machine, one which, my application needs. Am not finding this dll in...
2
by: CodeMonkey775 | last post by:
I'm having problems passing a variable to a method which is executed and compiled using CodeDom. The situation is I have a List<CellData> with cells, each containing a formula (like Excel). I am...
1
by: Niels Ull | last post by:
Hi! I'm using .Net 2.0 and C#, and I'm trying to generate code for build time AOP. But I cannot find out how to generate an anonymous delegate. E.g. generating code like this: class...
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
I may have painted myself into a corner with GenerateInMemory=true. My app need a custom user step. Users want to code (sort of - they are not programmers) some refinements to a search...
0
balabaster
by: balabaster | last post by:
I don't know if anyone's got any clue about this, but I have the following expression evaluator which makes use of the CodeDom to evaluate a VB.NET expression at runtime. This gives the system...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.