Problems upgrading from 4.1 to 4.2

I’m having a hard time getting this NETMF 4.1 to 4.2 upgrade thing going. Up 'til recently I was still using 4.1 with my Cobra board and was pretty much a happy coder, but now that I have upgraded my dev environment to NETMF 4.2 (I guess we’ll have to sooner or later, right?), I can’t even run/debug the simplest of apps. For instance, this is what Visual Studio spits out in the Output window whenever I try to debug a 4.2 project (a simple MF Console app with no other code except what comes with the template):


Found debugger!

Create TS.

Loading start at a0e00000, end a0e1383c

Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Security.PKCS11 (4.2
.0.0) Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.

Attaching deployed file.

Assembly: MFConsoleApplication1 (1.0.0.0) Resolving.

Link failure: some assembly references cannot be resolved!!

Assembly: Microsoft.SPOT.Security.PKCS11 (4.2.0.0) needs assembly ‘Microsoft.SPOT.Hardware’ (4.2.0.0)

Assembly: System.Security (4.2.0.0) needs assembly ‘Microsoft.SPOT.Security.PKCS11’ (4.2.0.0)

Error: a3000000

The program ‘[1] Micro Framework application: Managed’ has exited with code 0 (0x0).
Waiting for debug commands…

And if I try to target NETMF 4.1 instead, the project builds OK, but whenever I try to debug it on the device, strangely,enough, the process halts with the following “build error”:


Error 1 Cannot deploy the base assembly ‘mscorlib’, or any of his satellite assemblies, to device - USB:EMX twice. Assembly ‘mscorlib’ on the device has version 4.2.0.0, while the program is trying to deploy version 4.1.2821.0

I have a Cobra board and along with the other sw packages I have also upgraded ithe board’s firmware to version 4.2.7.0.

This is all too confusing. I’ve been talking to GHI’s support staff and according to them I’m not supposed to be having these kinds of problems.

Maybe someone here might have something to share.

Regards,
Marcos

this is a firmware mismatch issue.

do you have the MS Micro framework QFE2 SDK and the latest GHI SDK loaded on your PC, and the latest firmware loaded on your device?

you also have to update you project to 4.2. best thing to do is create a new 4.2 project and copy source . also dll names and namespaces have changed for 4.1.

take alook at GHI Electronics – Where Hardware Meets Software

Hi Mike,

I followed the .Net Micro Framework tutorial available on the support area (http://www.ghielectronics.com/support/dotnet-micro-framework). So I did download and install the following packages (and in the following order):

Once everything was installed I then upgraded my Cobra board’s firmware to version 4.2.7.0.

Before all this, my environment was all 4.1 based:

  • .NET MF SDK 4.1
  • GHI Software Package v4.1
  • Cobra board firmware 4.1.8.0

I haven’t even tried porting my projects yet. These two errors I’m describing are happening with projects created from scratch:

  • Visual Studio 2010 > New Project > Micro Framework > Console Application > Build > Debug (on the device)

If the project’s target is set to .Net Micro Framework 4.2, then the first set of errors occurs
If the project’s target is set to .Net Micro Framework 4.1 then the second error occurs.

First, you can not change between 4.2 and 4,1 without changing the firmware. the second error message is quite explicit.

I suggest you uninstall all the MS and GHI micro framework software and then reinstall. if you want
4.1 then you should install the optional GHI 4.1 SDK.

then create a default 4.2 project and try to deploy it. this should work. then start adding the references you require, one by one,
and deploy. If you have problem, then you which reference is the wrong version.

@ Mike - Maybe I was too verbose in explaning things and ended up being not so clear. So, just for clarification, my whole environment is now updated to version 4.2 - including the board’s firmware, which is now v4.2.7.0. I’ll try what you’re suggesting and I’ll get back with the results.

@ andre.marschalek - I haven’t (manually) added those assemblies. I’m trying to run a simple MF console project created from scratch and with no additional custom code whatsoever being added to it. So my assumption is that whichever assemblies are needed to run the project they should already be referenced by the template, right?

I uninstalled absolutely everything relating to NETMF / GHI / Gadgeteer, rebooted and then installed the following packages back in (in order):

  • Microsoft .NET Micro Framework 4.2 QFE2 SDK
  • GHI Software Package v4.2

Unfortunately, nothing did change much.

a) First Test

  • created a simple MF Console application (just the template - no custom code)
  • made sure it was targetting the .Net Micro Framework 4.2
  • tried to debug the project on the device
  • the same “linked assemblies missing” errors happened
  • only after manually adding the mentioned assemblies that the project could be debugged successfully on the device

b) Second Test

  • created another simple MF Console application (just the template - no custom code)
  • making sure this time that it was targetting the .Net Micro Framework 4.1
  • tried to debug the project on the device
  • the same “can’t deploy base assembly mscorlib… twice” error happened
  • tried manually removing reference to ‘mscorlib’ and then redeployed
  • same error

This is all too confusing… if testing simple and templated console apps created from scratch is this hard and troublesome, I don’t want to even start imagining the problems I’ll be facing once I tackle porting my 4.1 projects over to 4.2 !!!

@ mpenna - in your list of things you installed you did not say you installed the optional GHI 4.1 SDK. if your device has 4.2 firmware then you will not be able to deploy a 4.1 project. the firmware must match the project target version.

I have no idea why security dlls are being referenced in 4.2 project templates. I have never seen it.

I suggest you do not include 4.2 and 4.1 projects in same solution.

@ mpenna - do you get any errors when you compile? F6?

There are thousands, soon millions, of happy netmf users. I assure you that what you see is not typical.

Another thing to try. Uninstall all, including visual studio. Then make sure you delete the GHI electronucs folder completely in your program files. Then reinstall.

Let us know please.

@ Mike - I’m keeping these tests as simple as possible. For each one I created a new solution with a single (and very simple template-based) console app project. So I’m not mixing 4.2 and 4.1 projects together. Beats me why I’m getting these errors. So, what you’re saying is that since the board’s firmware is 4.2, I won’t be able to run/debug 4.1 projects, right? And vice-versa, right? So one can only ponder: what’s the use then of being able to “target different SDK versions” inside a NETMF project?

@ Gus - Please don’t get me wrong, but you must be kidding me… reinstall Visual Studio??? : O

right. you can only deploy/run projects for the firmware version on your board.

Gus’s suggestion is not unreasonable. you seem to be getting spurious references in virgin projects, leading to the theory that your VS has a problem.

are you using any VS plugins?

OK, guys… I’ll try this then… I’ll setup a fresh Win 7 VM and install and build everything up from scratch. Sounds like a good test route, to me… what would you say?

go for it.

Yes reinstalling visual studio is a crazy request and most likely is not the problem but it seems like you tried everything and close to giving up :slight_smile: so let’s start from zero and we all will try to figure it out together. I am only trying to help

Gus, plesae don’t take it personally… and sorry if I sounded a bit too sarcastic. It’s that I wasn’t quite ready yet to consider such a daunting task.

I’ll get back to you guys with the results as soon as I get this new VM going.

Same exact issue here. Installed everything current, and updated my firmware (FEZ Spider). Same problem. Output window:

Found debugger!
Create TS.
Loading start at a0e00000, end a0e1383c
Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Security.PKCS11 (4.2
.0.0) Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.
Attaching deployed file.
Assembly: MFConsoleApplication1 (1.0.0.0) Resolving.
Link failure: some assembly references cannot be resolved!!
Assembly: Microsoft.SPOT.Security.PKCS11 (4.2.0.0) needs assembly ‘Microsoft.SPOT.Hardware’ (4.2.0.0)
Assembly: System.Security (4.2.0.0) needs assembly ‘Microsoft.SPOT.Security.PKCS11’ (4.2.0.0)
Error: a3000000
Waiting for debug commands…
The program ‘[4] Micro Framework application: Managed’ has exited with code 0 (0x0).

welcome to forum!

add the missing reference

It just appears that the package I installed from MS did not include this reference.
Microsoft.SPOT.Security.PKCS11
In the object browser, I don’t see it listed - or when I look at the Class View.
All I’m doing is the very first exercise where you Debug.Print(“Amazing!”). But for some reason it requires this security reference.
Is there a way to bypass this, or to somehow get this new security reference? I downloaded and installed the precise 4.2 SDK linked to from GHI’s website here:
http://www.ghielectronics.com/support/dotnet-micro-framework

look at http://wiki.tinyclr.com/index.php?title=First_Project to see how to add missing references.

WOOPS! Sorry to waste your time. I didn’t see it listed. Checked twice. That security assembly was not in the list. When I checked the third time, there it was. I overlooked it. I added the reference, and it worked. Sorry to bother you!

You have to add that Microsoft.SPOT.Security reference to the project. The very first installed project doesn’t do it automatically.
In Solution Explorer, right click the project node, choose “Add Reference” browse to Microsoft.SPOT.Security and add it. That did it for me. It compiled fine and sent everything to my unit perfectly!