Error when trying to do form 'functions' through self-compiled dll
-
Tuesday, January 16, 2007 8:40 PM
When I use a .net framework compiled dll (compiled through code), it recieves this error, when I try to do basic form functions like myform.Show();, and stuff like that, I get this error when I do that.
The only references i have in the dll, are System;, System.Windows.Forms;
Is there one I am missing?
Line number 14, Error Number: CS0012, 'The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.;
Line number 14, Error Number: CS0012, 'The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.;
Line number 14, Error Number: CS0012, 'The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.;
All Replies
-
Tuesday, January 16, 2007 9:56 PM
hi,
as I see it this is due to the fact that the windows forms itself references a number of elements from the System.ComponentModel namespace.
You should add this reference to the code that is executing the dynamically generated code.
If that doesn't work, try adding the system.componentmodel dll in the bin directory of the application
Hope this helps, please close the thread if it does
-
Wednesday, January 17, 2007 1:24 AMWhere exactly is the System.ComponentModel, I tried adding it to my project's compiled (externally) references', and adding a using statement of it, and it says it doesn't exist. I also tried looking in my main project, the vs 8 one, and I couldn't find it in the .net add references tab, nothing there in System., starts with a 'C'
-
Wednesday, January 17, 2007 3:32 AM
Hi,
Do as the error message says "You must add a reference to assembly 'System...'
-
Wednesday, January 17, 2007 4:18 AM
The System.ComponentModel namespace lives inside the System.dll, make sure you have added a reference to this dll in your project.
Mark.
-
Wednesday, January 17, 2007 9:00 PM
Global
.Variables.Parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");I did...It doesn't give me an error when I try to reference System, through 'using' ;
The problem isn't referencing System, or System.Windows.Forms.dll, that works fine, and I can use anything inside MessageBox ex, MessageBox.Show("");, that works fine, compiles and shows the messagebox....
-
Thursday, January 18, 2007 2:23 AM
Hi, redator
That kind of error usually means the class that .NET expects to find in the dll compiled for the project is not found, app can't find any dll's with the right class.
Otherwise, the referenced dll maybe written in .net 1.x, while the app that reference the dll is dev in .Net 2.0.
Pls feel free to let me know, thanks. :-)
-
Thursday, January 18, 2007 10:23 PM
I really don't understand...I highly doubt that it is missing a dll, it works fine using a messagebox.show, just when it starts dealing directly with forms it does that, and everything else I've noticed is fine... -
Thursday, May 29, 2008 10:25 AM
I Just had this problem and fixed it by:
1. restart visual studio
2. remove the following references from my project: System, System.Data, System.Windows.Forms, System.Drawing
3. re-add the references above
Now it all works fine.
- Proposed As Answer by chatterbug Thursday, October 25, 2012 7:42 PM


