1
votes

I am porting some of the logic from old VB6 files to C#.

For easy reference, and to have the VB6 files available long-term for reference, I added them to my project and set the Build Action to None.

When I compile my project, I get over 100 errors in the Error List related to those files. If there are no other errors in the project, I get a Build Succeeded message and I can run or debug the project. If there are other errors, those errors are well-hidden among all of the VB6 related error messages.

I would prefer to keep the .bas file extension, because Visual Studio provides syntax highlighting that is mostly-useful, as VB6 and VB.Net share significant syntax.

How can I prevent Visual Studio from showing compile errors related to the VB6 file, and treat it simply as a reference document, without abandoning the .bas file extension?

1

1 Answers

2
votes

Visual Studio has no support for VB6 code. By using the .bas file type, you are telling Visual Studio that these are VB.NET files which, for some reason, you do not want to compile.

I don't see any way to get the best of both worlds here. Perhaps someone has created the document handling code for .vb6, or you could create your own using the Visual Studio SDK.

Also, a search of the Visual Studio Gallery for free tools for VB6 found two that look interesting: