Can we have vb.net / F#.net class files in C#.NET project…?

No, You can not mix vb and c# within the same project,but you can use them in the same solution. An assembly/project (each project compiles to 1 assembly usually) has to be one language. However, you can use multiple assemblies, and each can be coded in a different language because they are all compiled to MSIL.

You can add vb.net files to a c#.net project. Compilation also works. It compiles fine and didn’t complain because a  C# project will only actually compile the .cs files. It will ignore the other ones, therefore you will not receive errors.

Note: If you add a .vb file to a C# project, select the file in the Solution Explorer panel and then look at the Properties panel, you’ll notice that the Build Action is ‘Content’, not ‘Compile’. It is treated as a simple text file and doesn’t even get embedded in the compiled assembly as a binary resource.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s