-
Aug 14th, 2021, 07:52 AM
#1
Thread Starter
Addicted Member
Import c# project into VB.NET Project
I'm with my vb.net project and I found a ready c# solution but it's too big to convert to c# so I would like to bring all forms into my visual basic project is it possible to do this using only the main solution of my project?
A related question is, When I compile will both c# and vb.net compile?
-
Aug 14th, 2021, 08:36 AM
#2
Re: Import c# project into VB.NET Project
Your solution can have both VB and C# projects.
(Also, why would a project be too big to convert?).
-
Aug 14th, 2021, 09:05 AM
#3
Re: Import c# project into VB.NET Project
You could also make the C# project a dll, or reference it directly as a project in your larger solution. They work together pretty seamlessly.
My usual boring signature: Nothing
-
Aug 14th, 2021, 10:13 AM
#4
Thread Starter
Addicted Member
Re: Import c# project into VB.NET Project
Originally Posted by David Anton
Your solution can have both VB and C# projects.
(Also, why would a project be too big to convert?).
because it's a frequency pattern recognizer that I found in C# and it has many lines of code besides a dll.
In case I add it to the project as a solution, how do I refer to this form so that I call it MDI child? it's possible ?
-
Aug 14th, 2021, 10:16 AM
#5
Thread Starter
Addicted Member
Re: Import c# project into VB.NET Project
Originally Posted by Shaggy Hiker
You could also make the C# project a dll, or reference it directly as a project in your larger solution. They work together pretty seamlessly.
Thanks this is important, but in this case the project itself already has some dlls so it's better to include the forms inside the main solution (VB) I wanted to know if it is possible to also add an external .exe inside the references as if it were a txt or file , because depending on I create the .EXE and set it to TopLevel false and call it by main.
-
Aug 14th, 2021, 10:50 AM
#6
Re: Import c# project into VB.NET Project
I think you should be able to refer to the form like any other form, whether it's in the VB project or C# project. I don't do this myself, so maybe I'm missing something, but I don't see why it shouldn't be possible.
-
Aug 14th, 2021, 08:43 PM
#7
Re: Import c# project into VB.NET Project
You're asking questions that you already know the answer to, so put some thought into it. You use types defined in other libraries all the time. Why should this be any different? Add the prohject to your solution, make sure it compiles to a library rather than an application, reference it in your application project and away you go. You use the types in that library the same way you use the types in any other library you reference, which you have been doing since the very first project you created. You're trying to make this hard when it's not.
There's also no need to add the project to your solution if you don't intend to make any changes to it or need to debug it along with your app. You can just build the project on its own and then you can reference the DLL it generates like you would any other DLL. If you add the project to your solution, you can then reference the project instead of the output DLL, which allows you to debug into that project and make changes to the code and have them reflected immediately in your application project.
-
Aug 16th, 2021, 03:38 AM
#8
Re: Import c# project into VB.NET Project
Originally Posted by LiwisJames
Thanks this is important, but in this case the project itself already has some dlls so it's better to include the forms inside the main solution (VB) I wanted to know if it is possible to also add an external .exe inside the references as if it were a txt or file , because depending on I create the .EXE and set it to TopLevel false and call it by main.
If the C# project references DLLs already, those DLLs will still work when you make the C# project a DLL.
Last edited by Peter Porter; Aug 16th, 2021 at 03:44 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|