First, the compilation of the project. The project does not consist of the source files along. Another important part is project file which provides the set of references assemblies.
Further issues depend on how you compile the code.
I would recommend you performing compilation from CodeDOM. Referenced assemblies are passed as an array of strings as a parameters to the constructor of
CompilerParameters
.
See this code sample on the compilation:
http://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider.aspx[
^].
So, this should clear your "compiler somehow adds at compile time". There is not "somehow", it's totally clear.
Now, how about compile-time error in one case not not showing error in another case? Simple.
This requires referencing of the assembly
System.Windows.Forms:
var something = new System.Windows.Forms.Panel();
Apparently, if there is no error, this assembly is references.
This is completely different:
this.gearboxMainPanel1 = new FP.Forms.FP.Controls.NicePanel();
If requires some other assembly, the one you develop. You need to reference it, isn't that obvious?
Problem solved.
—SA