Answered by:
Accessing Registry .NET Compact Framework v1.0

Question
-
Hello, I'm feeling really stupid here. I am writing a mobile app that has to use the .NET Compact Framework v1.0. I need to read and write some registry keys. Simple! There are plenty of examples to copy. But I can't even get something using RegistryKey to compile. I have a reference to mscorlib and say "using Microsoft.Win32", but see the following error: "The type or namespace name 'Microsoft' could not be found (are you missing a using directive or an assembly reference?)" (This is C# and Visual Studio 2005.) Must be doing something trivial wrong?Saturday, October 17, 2009 10:10 AM
Answers
-
Hi,
The Microsoft.Win32.RegistryKey is not present in .NET CF v1.0, as stated in the following MSDN page :-
http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.aspx
You may be interested in the OpenNETCF.Win32 namespace which is part of the SDF :-
http://opennetcf.com/CompactFramework/Products/SmartDeviceFramework/tabid/65/Default.aspx
You may need to use one of the previous versions (1.4) as I am unsure whether the latest versions can be used with .NET CF v1.0.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/- Proposed as answer by Christian Resma Helle Monday, October 19, 2009 9:29 AM
- Marked as answer by Guang-Ming Bian - MSFT Tuesday, October 20, 2009 2:47 AM
Saturday, October 17, 2009 10:23 AM -
Hi,
You can P/Invoke the appropriate native methods however it would be simplier to use the SDF.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/- Proposed as answer by Michael Koster Sunday, October 18, 2009 9:16 PM
- Marked as answer by Guang-Ming Bian - MSFT Tuesday, October 20, 2009 2:47 AM
Saturday, October 17, 2009 10:48 AM
All replies
-
Hi,
The Microsoft.Win32.RegistryKey is not present in .NET CF v1.0, as stated in the following MSDN page :-
http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.aspx
You may be interested in the OpenNETCF.Win32 namespace which is part of the SDF :-
http://opennetcf.com/CompactFramework/Products/SmartDeviceFramework/tabid/65/Default.aspx
You may need to use one of the previous versions (1.4) as I am unsure whether the latest versions can be used with .NET CF v1.0.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/- Proposed as answer by Christian Resma Helle Monday, October 19, 2009 9:29 AM
- Marked as answer by Guang-Ming Bian - MSFT Tuesday, October 20, 2009 2:47 AM
Saturday, October 17, 2009 10:23 AM -
Thanks for your help again Paul. Is this the only way of accessing the registry in .NET CF v1.0?Saturday, October 17, 2009 10:44 AM
-
Hi,
You can P/Invoke the appropriate native methods however it would be simplier to use the SDF.
Hope this helps.
Paul Diston
http://www.smartmobiledevice.co.uk/- Proposed as answer by Michael Koster Sunday, October 18, 2009 9:16 PM
- Marked as answer by Guang-Ming Bian - MSFT Tuesday, October 20, 2009 2:47 AM
Saturday, October 17, 2009 10:48 AM