简体   繁体   中英

Can't reference a C# class library within a VB.NET class library

I have 2 projects in a solution, one a vb.net class library project, another a C# class library project.

As far as I was aware I was able to compile both and reference each from the other project, (one way at a time).

I can reference namespaces / classes found in the VB.NET project within the C# project. However I don't seem to be able to do the same in the opposite direction. I can't seem to use any namespaces / classes exposed in the C# library from within the VB.NET project, even though the library appears to be referenced correctly.

Am I missing something here?

EDIT: I am aware that cyclic references are not permitted and no I am not referencing each library from the other at the same time. I don't have any compilation errors relating to cyclic referencing.

This is because you cannot create circular references.

If the ddl of your first project is referenced in the second one there is no way you can add the other project as a reference also.

When building the solution both projects would depend on each other and this will fail.

This was an error on my part.

The problematic C# types in question that I could not see within my vb project had been set to content rather than compile within Visual Studio. This possibly occurred due to some file movement between the projects.

For me the reference error was due to difference in framework version. After I changed the version from project properties, the reference error got resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM