Snippet - Patch for NETMF under VS2015

I just posted Patch for NETMF under VS2015 on Codeshare. Feel free to discuss and make suggestions here.


I did this as a PowerShell script because I don’t really have time to argue with Wix and create a setup for it. The PowerShell script will apply these changes for you on the 4.1, 4.2 and 4.3 NETMF files, but the patches are pretty simple, and you can do them by hand if you prefer.

If you want to patch by hand, see here for the changes required : [url][/url]
Ignore the wix changes. You just need to do the changes to the three .targets files, for each NETMF version
The files can be found in version-specific subdirs of C:\Program Files (x86)\MSBuild\Microsoft.NET Micro Framework

1 Like


@ mcalsyn - Wow, thanks for the fix.

This does not work in VS2012 against a Visual Basic project for 4.3.

vbc : Fatal error BC2000: compiler initialization failed unexpectedly: Project already has a reference to assembly mscorlib. A second reference to 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\mscorlib.dll' cannot be added. 

Just create a default VB Micro Framework Console application and then run it. The default project already has a mscorlib reference. Removing this reference manually, does not work.

Man, you guys (or dolls) are sometimes too fast when answering posts. :slight_smile:

@ andre.m - I have modified the post. This happens in 2012 :-[

So why is this happening? Applying the fix was the only change I have made in the recent past.

Same answer as @ andre.m gave for VS2013…

The script only changes the path to the compiler. For VS2012 and VS2013, the change should have no impact (because it just points you at the 4.0.30319 compiler (the pre-Roslyn compiler) that VS2013 already uses by default (and presumably, VS2012 does too). It does not make any changes to any reference paths.

I did not test with VS2012 (and don’t plan to) and did only a cursory VB test. If you think this patch is causing you problems, as an experiment, you can edit the files in the v4.1, v4.2 and v4.3 directories under C:\Program Files (x86)\MSBuild\Microsoft.NET Micro Framework. Remove the CSCTOOLEXE and CSCTOOLPATH elements in those files. Or uninstall and re-install your NETMF SDK to get back to the original content.

Yes, the patch is to fix usage under VS2015, but it should be harmless to VS2012/2013 because it specifies the compiler that is already being used. I run VS2013 and VS2015 side-by-side and I’m not having any problems under either one.

But again, I am not a heavy VB programmer (one program in the last year to help someone out), and I don’t have 2012 installed.

So, if you don’t use VS2015, there’s no reason to install this patch.
If you do use 2015, this patch should be harmless to VS2013, and that has been tested.

I tested this on VS2013 (against 4.3) just now, and still get the same error…

Let me undo the changes as suggested by @ mcalsyn and see what happens.

OK, removing that VBCToolExe and VbcToolPath elements from “VisualBasic.Targets” for 4.3, solves my problem for both vS2012 and VS2013.

I guess I’ll have to learn to love VB a bit more - I’ll look into this, but it will be a week or so before I can.

@ mcalsyn - Thanks. No hurry. At least I can now continue to tinker… :smiley:

and maybe just switch over to C#, but then again, it was precisely because of the support for VB that brought me to the .Net Micro Framework and to this site and forum. ;D

It has opened up a total new world to me (and I am sure to a lot of other VB developers). I am still at the tinkering stage, but the issues with VB makes it, at this stage, not really an option for doing anything real. For that I will probably need to switch over to C#, but this is digressing and a topic all on its own…

I am attempting to not install anything but VS2015 on my new dev machine, but when I compile my projects I am getting a very strange error (see image) 0x80131700. I followed the directions here, .NET Micro Framework – GHI Electronics and then applied @ mcalsyn’s VS2015 patch. Any idea how to fix this?

@ andre.m - Awesome! Worked Great! Thank you!

Thank you! Works great for deploying to my Netduino Mini (NETMF 4.2) using VS2015. Before running this patch I was faced with “Cannot parse method signature” errors on build for code that had previously worked fine under VS2010 or VS2012 Express.

Happy to be successfully using VS2015 with older and newer NETMF hardware!

@ jtreynol - we are trying to put this in our sdk so it is fixed automatically. I think it will still work with your device.

@ Gus - That would be awesome; thanks Gus.

Yes taht would be great.
But please do not Forget to reverse it, as soon as VS2015 officially Supports NETMF (with 4.4 I guess)

Actually, no - you don’t want to reverse it. It is sdk-version-specific. 4.4 already contains the fix, but only within the 4.4 .targets files. This patch fixes the 4.2 and 4.3 .targets files.

We would only want to undo this patch if a new 4.2/4.3 Microsoft SDK were to be released, and in the github issue tracking this, Microsoft said they were not planning on another 4.3 QFE release.

And because this changes the Microsoft provided .targets files, it should work for all netmf targets (that is, all devices that build against the 4.3QFE2 netmf)…

So, I’ve just looped back to this problem and succeeded in getting netmf v4.3 VB projects building under VS2013 and VS2015. I was able to reproduce your problem under VS2013, so I may assume that this fixes it for VS2012 as well (sorry - I don’t have VS2012 installed).

If you are only using VS2012 or VS2013, you do not need to make any changes! Do not apply the VS2015 patch.

But if you want to use VS2015, or you applied my VS2015 patch script for any reason, then you MUST also do this to your .vbproj files:

If you apply the VS2015 patch, then netmf 4.3 VB projects will fail to build under VS2015 and VS2013 (and presumably 2012) unless you also modify your .vbproj files as in the link above.