7 May
2009

Building .netcf with TeamCity

OK, this actually wasn?t too bad, but here is what I had to do to get TeamCity to compile my .net Compact Framework project.  Mind you, I was trying to do this without installing Visual Studio 2008 on the build server.  This is spesifically about the project/solution changes you will need to make to get this to work.  Once those changes are complete it turns into a standard TeamCity setup.

First: Install NETCFSetupv35.msi on your build server. 

Second: from your developer machine, go to C:\Windows\Microsoft.NET\Framework\v3.5 and copy

  • Microsoft.CompactFramework.Build.Tasks.dll
  • Microsoft.CompactFramework.Common.targets
  • Microsoft.CompactFramework.CSharp.targets
  • Microsoft.CompactFramework.VisualBasic.targets

To the same directory on your build server.

Third: in the projects in your .net cf solution, copy these files to your solutions libs folder:

C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll
Assuming you are using MSTest and have unit tests for your project
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SmartDevice.UnitTestFramework.dll
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SmartDevice.UnitTestFramework.xml

Note: about the libs folder.  In the same directory of every solution that I create is a libs folder.  This folder contains EVERY third-party dll that my project needs to compile that is not included with the .net Framework.  Then, when I reference the dll, I do it from the libs folder.  I also check that folder into source control.  Now any developer that needs to compile this project will/should have everything they need to compile.

Those are all of the solution changes needed to get project to compile on build server.  After those are in place TeamCity can compile your .netcf 3.5 project like any other project.  I typically use the sln2008 build runner for simplicity as well.

But there is a fly in the ointment.  I cannot figure out how to get TeamCity to run my MSTest tests without VS 2008 installed on the server.  I am against doing that, but I might have to.  Also, because of limitations with testing .net cf, the tests have to be MSTest.  NUnit (et al) wont work for me.

UPDATE (July 21, 2009)

Setting up a new server, saw some new errors. Like this one:

error MSB4018: The "GetDeviceFrameworkPath" task failed unexpectedly.

This page had the fix for me:

http://www.nullify.net/ViewArticle.aspx?article=287

Which was to run this registry script:

   1: Windows Registry Editor Version 5.00
   2:  
   3: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\v3.5.0.0\PocketPC\AsmmetaBinder]
   4: "TypeName"="Microsoft.CompactFramework.Build.PocketPC.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"
   5:  
   6: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\v3.5.0.0\PocketPC\AsmmetaBinder\4118C335-430C-497f-BE48-11C3316B135E]
   7: "TypeName"="Microsoft.CompactFramework.Build.WM50PocketPC.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"
   8:  
   9: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\v3.5.0.0\Smartphone\AsmmetaBinder]
  10: "TypeName"="Microsoft.CompactFramework.Build.SmartPhone.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"
  11:  
  12: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\v3.5.0.0\Smartphone\AsmmetaBinder\BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39]
  13: "TypeName"="Microsoft.CompactFramework.Build.WM50SmartPhone.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"
  14:  
  15: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\v3.5.0.0\WindowsCE\AsmmetaBinder]
  16: "TypeName"="Microsoft.CompactFramework.Build.WindowsCE.BindingService, Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null"

UPDATE (July 31, 2009)

Recently, on a new project, I got a new error message:

?error MSB4018: The "AddHighDPIResource" task failed unexpectedly.? 

It took me a while, but I finally found the answer here:

http://throwachair.com/2008/10/09/of-visual-studio-device-projects-resources-and-msbuild/

For those of you just looking for the answer: in your project file (which is an msbuild script), add the following code:

   1: <PropertyGroup>
   2:    <HighDPIResAware>1</HighDPIResAware>
   3: </PropertyGroup>

and that fixed it for me.

4 thoughts on “Building .netcf with TeamCity

  1. Have you tried using the nunit 2.2.9 tester yet? it’s deprecated but that was the only way I could get team city to run my MS Tests.

Comments are closed.