Main Site Documentation

Using NETMF in VS2017


#1

While TinyCLR OS is our focus going forward, we understand that many products are already complete with NETMF and in active use in the field that need occasional tweaks. Of course you can use VS2013 or VS2015 with the official NETMF extensions, but sometimes it’s just easier to use VS2017 instead of maintaining multiple old installs. Unfortunately, there isn’t an official VS2017 extension for NETMF, but it is possible to tweak the official beta one for VS2015 so that it works in VS2017 in an unsupported fashion. We did test this out ourselves so wanted to share it here, even if we can’t official support it or make it available.

To get started, you need to get the VS2015 extension from the NETMF 4.4 release (it’s called NetMFVS14.vsix). You can find this in the CodePlex archive. VSIX files are actually just zip archives with a different extension. So you can either change the extension to zip and extract its contents to a folder or use an archiving tool to open it.

Look for an open the file extension.vsixmanifest. It’s a plaintext file, so a program like Notepad++ can edit it. It should look like this:

You need to change a few things inside it. On line 14, change the version so that it looks like Version="[15.0,)". Then on line 18 change the MPF version to 15 as well. It should be <Dependency Id="Microsoft.VisualStudio.MPF.15.0" DisplayName="Visual Studio MPF 15.0" Version="[15.0]" />.

In the same folder delete the _rels folder (this contains the digital signature that is now invalid since we changed the contents). Go ahead and rezip all of the files and change the extension back to VSIX. Make sure you don’t create a top-level folder in the archive. The archive should contain all of the existing files and folders directly at the top level. When you go to install you’ll get a warning that the extension may not be compatible, you can go ahead and ignore it. Make sure to also install the NETMF 4.3 and GHI SDKs as well.

NETMF%20Warning

You can go ahead and create a NETMF project just like you would before. By default it’ll use NETMF 4.4, you can change it to 4.3 in the usual way. You’ll get build errors though, that it can’t find .NET 4.3 assemblies. This is because MSBuild has changed how it works in the latest VS2017 updates. To fix it, open the csproj file and find the property NetMfTargetsBaseDir. You need to replace $(MSBuildExtensionsPath32) with the actual path of where NETMF installs the files. On my computer it is C:\Program Files (x86)\MSBuild and the entire updated line looks like <NetMfTargetsBaseDir Condition="'$(NetMfTargetsBaseDir)'==''">C:\Program Files (x86)\MSBuild\Microsoft\.NET Micro Framework\</NetMfTargetsBaseDir>.

Save the csproj and reopen the project in Visual Studio. You should now be able to deploy and debug! You will need to edit every csproj file that you want to open in VS2017 like this.

We’ve also made all of the installers from our latest 2016 R1 SDK available in a zip archive so you can bypass the master installer and the bootloader tools. You can find it on the NETMF downloads page. Keep in mind that the above steps are not supported by us or by Microsoft, use is entirely at your own risk. Parts may not work or it may not work at all now or at some point in the future.


#2

Or you can use this one, from the Visual Studio Marketplace, and get automatic updates: https://marketplace.visualstudio.com/items?itemName=PervasiveDigitalLLC.pdnetmf-extension. It also contains a couple of bug fixes to resolve crashes in debugger.

You can also use the Marketplace release with the GHI 2016 R1 SDK mentioned above.


#3

Your URL is good.


#4

After successful software installations, NETMF 4.4 could not be deployed to G400D because of the following error:

Capture%20mscorlib

Unless GHI upgrades to NETMF 4.4, we must keep on NETMF 4.3 in V@2017.
Is it?


#5

Correct, regardless of which VS you use, we still only support NETMF 4.3. You’ll need to install that SDK and switch to that target framework.


#6

Thanks. The difference is VS2017 instead of VS2013 only.


#7

@Kok_Hung look on this link

http://informatix.miloush.net/microframework/Articles/VS2017SDK.aspx

how to use .NET 4.3 SDK on VS2017


#8

Thanks. Both NetMF 4.3 and 4.4 can be used too.


#9

I have seen this link before but was to lazy to try it. I am still using VS13 and VS15 for updating old projects. I followed the link an the changes worked. Now I can use VS17 for all my projects. The last couple of changes seems a little confusing.

These are the files I copied at the end of the article.