简体   繁体   中英

.NET Programming - Can I access members of a C-Sharp project from my VB.NET Project?

I have a multi-project .NET 3.5 solution.

It's ASP.NET based with c# code-behind in all projects except one.

I'm attempting to access members from a C# project called "Core" from a VB.NET project.

I set a dependency to the Core solution in my solution properties.

However, Core. brings up nothing.

Furthermore, my other C# projects that have Core-Project as a dependency (in the solution settings), are able to declare Core objects. Example: Private Core.ObjectName InstanceName; Also, Intellisense brings up plenty of info in the C# projects.

Any idea on how I can hook into these members from my VB project?

Thanks!

Add the C# project as a reference, not a dependency. This is done through the solution explorer by right-clicking on References underneath the VB project. You'll see a window pop up; select the Projects tab and find your C# project there.

Dependencies, by contrast, only influence the build order. You can set a project to depend on another (ie ensuring the other is built first), but that doesn't allow the first project to use the other project's code.

Finally, setting a reference also automatically sets a dependency, so you don't need to do both.

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