Determine .NET CF version?

G

Guest

I'm developing an application targeted at the WM5 Pocket PC platform. I want
to do some P/Invoke where I need to use MarshalAs. As far as I understand,
MarshalAs should be available in CF 2.0 but maybe I have misunderstood that?

I have installed CF 2.0 with the netcfsetupv2.msi file. Still I get an error
message when I try to use the MarshalAs keyword (using
System.Runtime.InteropServices).

How can I determine what version of the CF Visual Studio 2005 is using?
Am I correct in my assumption that MarshalAs is available in CF 2.0?
 
D

Daniel Moth

Yes, MarshalAs is supported in v2.

Some clues that may help:
1. If you are getting a compile-time error when using a type, make sure you
have fully qualified the type (or inserted imports/using at the top of the
file with the relevant namespace). This assumes you are at least referencing
the assembly that hosts the type in the first place.

2. VS2005 can also target v1.0, not just v2.0 of the NETCF. So if you are
not seeing some v2 behaviour, make sure you have created the correct project
(you can check this in the project properties).

3. To get the CF version at runtime (or to check what is on your device) see
this:
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ/DeterminingVersion

Cheers
Daniel
 
G

Guest

I have investigated the project properties, but I cannot find any information
on what CF version that is used, the only related info I find is the check
box to deploy the "latest" version of the framework.

I did install the framework 2.0 correctly, and I deployed it correctly to
the mobile device, but I still got the errors. Finally I found a clue on the
project context meny - "Upgrade project". There I could upgrade my project to
CF 2.0 status.

So...now it works, but it wasn't really intuitive to find the answer...
 
D

Daniel Moth

So point of 2 of my reply was the clue, glad you got it working. For future
reference, as I said, you can see what framework version you are targeting
by looking at the properties window of the project.

1. Select the project node in solution explorer (the node above 'properties'
and below 'Solution')
2. From the menu at the top, "View->Properties Window"
3. Observe the cell to the right of the cell named: 'Framework Version'

Cheers
Daniel
 
G

Guest

OK, now I understand why I couldn't find the information you where talking
about. I right clicked the project and selected "Properties"...and got the
"Property Pages" instead of the "Properties Window"...

Thanks for the help :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top