You need to rebuild the markup (only ASCX files) from the C # project to the project of your VB web application and specify these ASCX instead of C #. It sounds weird, but trust me, it works.
1 - Add the post-build event to the C # project, which copies the UserControl markup (.ASCX files only) to the folder in your web application project; for example, a folder under the root of your web application called "ExternalUserControls"
(Note that they must have the same Inherits property, i.e. the namespace and class name from the C # project.)
2 - Make sure the C # project is referencing (it seems that it already exists)
3 - Add management declarations to the <controls> <pages> of <system.web> in web.config: -
<system.web> . . <pages> <controls> <add tagPrefix="cc" src="~/ExternalUserControls/MyControl.ascx" tagName="MyControl" /> <add .... etc
4 - link to the controls on your page: -
<cc:MyControl id="testControl" runat="server" ..
5 - make sure that Import correct namespace for the control, as defined in a C # project
6 - Please note that sometimes the VS page designer refuses to add a variable for your control, therefore, in order to access your control in the code, you will need to add a level of protected at the page level (or any other VB equivalent, I cannot remember) a variable of the correct type, using the same name as in the page markup (testControl in the above example)
Let me know if you want an example.
source share