I have started using VS 2015 and NETMF 4.3.1 and it works find with C# but I cannot build the simplest VB program. I have also installed VS 2013 and used it for months without issue for both VB and C#.
I have attached a screengrab that shows how Microsoft.VisualBasic is referenced. I have removed the reference and added it back (assuming that I could not add it back if it did not exist) and this does not change things.
Has anyone built code with VS2015 and VB successfully? Can anyone suggest a fix?
@ andre.m: I sure hope that is not the case as VB NETMF templates are clearly available in the VS Create new project listing! This would really confuse folks
I looked at gitHub (Vs2015 by smaillet-ms · Pull Request #100 · NETMF/netmf-interpreter · GitHub), and found this:
[quote]miloush commented on May 24
@ smaillet-ms • disabled VB support
Seems that all the compilation errors with Roslyn for VB come from the My template, which makes no sense on device as is anyway (MyProject class + Application, Computer, User and WebServices), unless we have special MF one. This can be disabled however, by defining _MYTYPE=“Empty”.
To get rid of the could not find library Microsoft.VisualBasic.dll BC2017 error, /vbruntime- compiler switch works. Since we are referencing our Microsoft.VisualBasic.dll explicitly, it shouldn’t be a problem, or, perhaps more correct way would be to reference it using that switch: /vbruntime:“C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.VisualBasic.dll”
Edit: Oh yes and apparently for runtime, STAThreadAttribute has to be defined somewhere.[/quote]
So, now my problem is how to set the compiler switch. Is this done on the command line when launching VS, or can this be entered in the code being compiled?. I have searched all the various options but have not come come up with anything on exactly how to do this.
@ andre.m: Thanks for the reply. It does not really help because I do not know exactly what to do with the compiler switch. Is this something that is entered in to a command window before loading VS? (that did not seem to work), or is it something hidden someplace in a Visual studio window? (spent at a least an hour looking and not finding) Or is this a compiler directive entered in my code? (cannot find a syntax that accepts it). Or is this a registry entry?
I have not succeeded in building totally from within in VS, but you can get a VB program to build and deploy by a combination of VS and command line, firstly by editing the .vbproj file and setting this in the first PropertyGroup:
Unfortunately, you also need to add /vbruntime- to the compiler command line, and I have not found the right place to do that from within VS (sorry, not a VB guy). Supposedly, you can add <NoVBRuntimeReference>True</NoVBRuntimeReference> to a PropertyGroup, but that didn't work for me. I had to copy the vbc command line (from a detailed output log) and manually add /vbruntime-, but that did give me a good compile. Then I could use "Deploy" from Visual Studio to deploy to the board. Note that you also have to create a stub class for STAThreadAttribute as mentioned in the netmf posting. I know that's sketchy guidance, but I don't really have a moment now to do it more step-by-step. If I get time tomorrow, I will write up something more definitive.
@ mcalsyn: If you get any solution, let me know. It would be great to get this information easily found on the web, solution or no solution, as others would surely encounter it.
I went to 2015 from 2013 after having VS2013 started throwing fits. I could load, compile and debug a program ONCE. Then when restarting the main program window would disappear and could not be loaded again. Other windows could be loaded, but not the main one. If I stopped VS and restarted, then I would get another single run session before the main module “disappeared” from the being able to be loaded. It still exists in the Solution Explorer,. This happens in both C# and VB. Just started yesterday. No error messages or hints why. It is not the build or deploy that makes it disappear, but the stopping of the deployed program. This happens with the simplest Windows Forms application, so this is not NETMF but VS. I have tried resetting (Import and Export Settings Wizard/Reset all settings) but no impact, other than to cause a Guid message to appear. “Guid should contain 32 digits with 4 dashes” so it might be somehow related.
I look at project Assembly Information but there appears to be a valid GUID. Wish me luck, I will keep trying…
Here is the solution : https://www.ghielectronics.com/community/codeshare/entry/1039
@ mcalsyn: I really appreciate you going to the trouble to sort this out.
No worries - you’re welcome! If I get a chance later this week, I will submit a pull request to the netmf project so that these fixes can become part of the default VB template and also to add the STAThreadAttribute to the NETMF version of Microsoft.VisualBasic.dll.
That won’t do much for you now, but if they take it, it means we’ll have a better situation when 4.4 comes out later this year.
@ andre.m - That pull request was never accepted and the topic branch that contained it was deleted on May 13.
Closing the loop based on discussion with NETMF devs : They will be forcing use of the pre-Roslyn compiler (the VS2013 compiler), so this issue will go away for VS2015 targetting NETMF 4.4. If you want to use VS2015 targetting NETMF 4.3, you can use the workaround that I posted above.
Thanks. That helped me too. +1
Looks like VB is getting more love : [url]https://github.com/NETMF/netmf-interpreter/pull/394[/url]
The fix is targetted at v4.5 beta 1. I have not looked at it close enough yet to determine whether I can fold it into my patch tool, nor whether it makes v4.3 work as well.