serhio
serhio

Reputation: 28586

Combine C# and VB.NET in a solution

I have a solution, Winforms, mainly composed from VB.NET projects (Wiforms, Constrols and business classes).

How, I added to it a WPF project, but wrote it in C#.

Actually, every time I make a modification in the WPF C# project, I need to (re)build the C#WPF project.

Is there a option to make it work like other (VB.NET) projects (accept and "see" the changes without rebuilding the C# project)?

An example:

When I reference project "R.VB" in project "M.VB", I add a method "DoTest" in the "R.VB" and use that method in "M.VB" without compile errors.

If I add "DoTest" in the C# WPF Control and try to use it in "M.VB" project, I recieve a compile error "DoTest" is not a member od "R.C#Class".

C# options in my VS

enter image description here

Upvotes: 0

Views: 1297

Answers (5)

Pben
Pben

Reputation: 1101

if you need dynamic build you can take a look at project Roslyn

more info here

"Developers could also use the output of such software to do tasks like refactor, or reorganize, their code more easily, to add C# and Visual Basic functionality to programs written in other languages. It also adds dynamic typing to the statically typed C# and Visual Basic, allowing developers to add objects and new variables to a program on the fly."

Upvotes: 0

jrummell
jrummell

Reputation: 43067

If project A references project B, A can't see changes in B until project B is rebuilt.

However, if you want autocompletion and a few other tricks before recompiling referenced projects, you could use an extension that looks at your source code instead of your compiled output, such as ReSharper.

Upvotes: 0

Matthias Meid
Matthias Meid

Reputation: 12503

Do you have both the VB.NET projects and your C#/WPF stuff in the same solution? They should automatically rebuild if you do. If you use an assembly reference, you need to do it by hand. As far as I know, changing the code without rebuilding in VB6-style is not supported in .NET anyway...

Upvotes: 0

Chriseyre2000
Chriseyre2000

Reputation: 2053

No, C# does does support background compilation.

Upvotes: 1

dice
dice

Reputation: 2880

No- if you change the code you need to re-compile, at least I think that is what you are asking.

Upvotes: 0

Related Questions