My solution structure in vs is as follows.
- MyRuleEngineFramework
- RulesEditor
MyRuleEngineFramework is a class library. RulesEditor is a winforms project. The latter references the former, however, that assembly is not consumed inside of the editor project anywhere.
There are just few lines of code where I do a kind of referencing:
CSharpCodeProvider provider = new CSharpCodeProvider();
CompilerParameters cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("System.dll");
cp.ReferencedAssemblies.Add("MyRuleEngineFramework.dll");
cp.OutputAssembly = "temp.dll";
cp.GenerateInMemory = false;
CompilerResults cr = provider.CompileAssemblyFromSource(cp, SourceCode);
The above code executed fine and I got the compiled assembly the first time.
Then I registered MyRuleEngineFramework.dll to the gac.
After this the generated code (SourceCode
) did not compile. Then I removed the reference to the dll in the editor project (while assembly was still in Gac), it still did not compile.
Now why does this happen?