I'm working on a project started in VB9 (VS 2008) and now I've migrated to VS2010 (VB10) but on the production server the IDE is still VS 2008. On my developement enviroment the code compiles fine, but sometimes, - let's say - I forget an _ at the end of the line which causes the VB9 compiler to throw an error.
So the question is, how could I build a project with the VS 2010 IDE but VB9 compiler? Or to force the VB10 compiler into VB9 mode?
Unfortunately no there is not a way to accomplish this. When compiling in Visual Studio you aren't actually using the command line compiler. Instead you use the inproc hosted compiler (true for both VB.Net and C#). This compiler, while capable of outputting completely valid IL for down targeted platforms, is the version tied to Visual Studio (in this case 10.0).
There is no general way to shell out to a different version of the compiler or to the command line and get the behavior you're looking for.
What you can do though is set the language version of the compiler to be 9. This will issue warnings for a subset of parse level constructs which are not supported in VB9. This cannot be done from the IDE but can by editing the project file directly and inserting the following
<PropertyGroup>
<LangVersion>9</LangVersion>
</PropertyGroup>
Original Answer: Valid for targeting 3.5 but not this question
What you want to do is have your VB project target the 3.5 framework. This will cause the compiler to issue warnings on items that are not valid like _
's.
This can be done from the project properties page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With