NETCF 3.9 Released?

2020-05-24 11:47发布

问题:

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.

回答1:

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.



回答2:

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