OK! I know that most new mobile development is occurring on Windows Phone 7, iPhone or Android, but I have no other choice than Windows Mobile 6 for the application I’m currently working on due to customer requirements. So, here I am stuck back in VS 2008 developing a mobile application for Law Enforcement. In the past I played around with mobile development in my spare time, but never had to do any long term development for it. Since starting on this current project I noticed how long it took for my builds to deploy to the emulator and test devices for debugging. Deployment was taking from a few minutes to over 5 minutes at times. Well, you know as well as I do what that can do to developer productivity!
Now, I’m the type of developer that codes a chunk of code, builds, tests, and repeats the process in rapid succession so I was really not having any fun. So to figure out what was going on I set the Build output to “Diagnostic” in my Build options and hit F5. Well, I noticed that it was hanging on a build task called “PlatformVerificationTask”. Well, after digging around a little on Bing. I found this old blog post. The short of it is that the Platform Verification Task does a check on your assemblies at build time to make sure there are no unsupported properties, methods or events in your code. This process can really slow down the build process on large applications that have multiple DLLs. (Like my project does!)
So, what the solution? It’s a good ‘ole file editing trick. All you need to do is edit the file located at %windir%\Microsoft.NET\Framework\v2.0.50727\Microsoft.CompactFramework.Common.Targets and find the node:
<Target
Name="PlatformVerificationTask">
<PlatformVerificationTask
PlatformFamilyName="$(PlatformFamilyName)"
PlatformID="$(PlatformID)"
SourceAssembly="@(IntermediateAssembly)"
ReferencePath="@(ReferencePath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
PlatformVersion="$(TargetFrameworkVersion)"/>
</Target>
Add the following attribute to the <PlatformVerificationTask"> node:
Condition="'$(DoPlatformVerificationTask)'=='true'"
Now restart Visual Studio 2008 and check out how much faster your build is!
Tags: .net, compact framework, tips & tricks