3

I was trying to open one of my old projects build with VS2008 and it has a class library targeted for Windows Mobile 6 devices (.NET Compact Framework 3.5). Since the good old VS2008, there is no support for mobile devices in VS, AFAK. Now i can read everywhere that VS2012 supports CF3.9 and mobile devices again, and is backward compatible with CF 3.5. I think they call it 'Windows Embedded Compact' now, or something. But all is just BLOGS.

Where i can find the SDK for the new Compact framework? Is it released yet, or is the CTP release date known? Is there currently a way to compile an assembly for WM6[.5] with VS2012?

I need to recompile the CF3.5 project.

d.popov
  • 4,175
  • 1
  • 36
  • 47

2 Answers2

8

Not certain where this "everywhere" is that you're reading, but it's wrong. Compact Framework 3.9 has not been released yet. It will be released when Windows Embedded Compact (Window CE) 2013 is released, which should be in the first half of this year (2013).

Even when it is released, you still will not be able to use Visual Studio 2012, or Compact Framework 3.9 for an earlier version of Windows CE. The tools and compiler will be for 2013 only (not saying I agree with or like this, just reporting the facts).

If you are targeting WinMo 6.x, your only option today is CF 2.0 or CF 3.5 with Studio 2008, and I don't suspect that will change, even when a new version of the CF is released.

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • Thanks. That's why there is not much info - it is not yet released. I saw that about 'Windows Embedded Compact' but as I hear it for the first time, I got little confused..... So MS are selling the same OLD product (WinCE), with new NAME, and NO backward compatibility. Great!!! – d.popov Jan 17 '13 at 21:46
  • Can you provide a citation for the issue of needing VS2008 with CF 2.0 and CF 3.5? I am pretty desperate for a Microsoft-based document containing that information. – Thomas Jan 13 '15 at 14:38
  • I'm not aware of any specific positive documentation - you only get "negative" documentation. Newer versions of Studio don't include the feature and typically products don't document what they don't do. – ctacke Jan 13 '15 at 17:59
6

So you can get CF 3.5 building in VS2012 with a few csproj tweaks. First install NETCFSetupv35.msi and NETCFv35PowerToys.msi. You might need to use the follow reg hack to fix x64 bit stuff.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0]
"Language"="1033"
"Version"="3.5.7283"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\InstallRoot]
@="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\CompactFramework\\v3.5\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PocketPC]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PocketPC\AsmmetaBinder]
"TypeName"="Microsoft.CompactFramework.Build.PocketPC.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PocketPC\AsmmetaBinder\4118C335-430C-497f-BE48-11C3316B135E]
"TypeName"="Microsoft.CompactFramework.Build.WM50PocketPC.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PocketPC\AssemblyFoldersEx]
@="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\CompactFramework\\v3.5\\WindowsCE\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PowerToys]
"Language"="1033"
"Version"="3.5.7338"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\PowerToys\InstallRoot]
@="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\CompactFramework\\v3.5\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\Smartphone]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\Smartphone\AsmmetaBinder]
"TypeName"="Microsoft.CompactFramework.Build.SmartPhone.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\Smartphone\AsmmetaBinder\BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39]
"TypeName"="Microsoft.CompactFramework.Build.WM50SmartPhone.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\Smartphone\AssemblyFoldersEx]
@="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\CompactFramework\\v3.5\\WindowsCE\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\WindowsCE]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\WindowsCE\AsmmetaBinder]
"TypeName"="Microsoft.CompactFramework.Build.WindowsCE.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NetCompactFramework\v3.5.0.0\WindowsCE\AssemblyFoldersEx]
@="C:\\Program Files (x86)\\Microsoft.NET\\SDK\\CompactFramework\\v3.5\\WindowsCE\\"

Then you will need to create a new .target file similar to this.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(BuildForWinCE)' == 'true'">
    <MSBuildBinPathCF>C:\Windows\Microsoft.NET\Framework\v3.5</MSBuildBinPathCF>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <IntermediateOutputPath>obj\WinCE</IntermediateOutputPath>
    <OutputPath>bin\WinCE</OutputPath>
    <FrameworkRegistryBase>Software\Microsoft\.NETCompactFramework</FrameworkRegistryBase>
    <AssemblyFoldersSuffix>$(PlatformFamilyName)\AssemblyFoldersEx</AssemblyFoldersSuffix>
    <AssemblyFoldersExConditions>,OSVersion=$(OSVersion):Platform=$(PlatformID)</AssemblyFoldersExConditions>
    <TargetCompactFramework>true</TargetCompactFramework>
    <DefineConstants>$(DefineConstants);WindowsCE</DefineConstants>
    <NoStdLib>false</NoStdLib>
  </PropertyGroup>
</Project>

Then you can include your new targets file and conditional compact framework targets in your csproj

<Import Project="Compact.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Condition="'$(BuildForWinCE)' == 'true'" Project="$(MSBuildBinPathCF)\Microsoft.CompactFramework.Common.targets" />

When you want to build for WinCE just set the following parameter.

BuildForWinCE=true
Aaron Stainback
  • 3,489
  • 2
  • 31
  • 32
  • Great "Workaround" - Is this also possible for VS2013? – Sven Apr 01 '14 at 14:35
  • Hi, VS 2013 gives such error when opening my old solution: The application which this project type is based on was not found. Please try this link for further information: http://go.microsoft.com/fwlink/?LinkID=299083&projecttype=4D628B5B-2FBC-4AA6-8C16-197242AEB884 Did I miss something? – deerchao May 31 '14 at 10:59
  • And even if I made it, I still can't use vs2013 to debug on my devices, right? If that's the case, I'll just stick to VS2008. – deerchao May 31 '14 at 11:09