Thursday, January 28, 2016

Embedded Dev - Long builds with Platform Verification Task

If you are experiencing an extremely long build time on a windows mobile C# project with Visual Studio 2008, you can try to disable Platform Verification Task.
Platform Verification Task (PVT) is a post-build validation step to catch the unsupported PMEs before they can result in a runtime exception.
Go to file: C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.Common.targets

Search the following element:
<Target
        Name="PlatformVerificationTask">
        <PlatformVerificationTask
            PlatformFamilyName="$(PlatformFamilyName)"
            PlatformID="$(PlatformID)"
            SourceAssembly="@(IntermediateAssembly)"
            ReferencePath="@(ReferencePath)"
            TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
            PlatformVersion="$(TargetFrameworkVersion)"/>
</Target>

and add the bold line:

<Target
        Name="PlatformVerificationTask">
        <PlatformVerificationTask
   Condition="'$(DoPlatformVerificationTask)'=='true'"
           PlatformFamilyName="$(PlatformFamilyName)"
           PlatformID="$(PlatformID)"
           SourceAssembly="@(IntermediateAssembly)"
           ReferencePath="@(ReferencePath)"
           TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
           PlatformVersion="$(TargetFrameworkVersion)"/>
</Target>
Finally restart Visual Studio, rebuild your project and the problem should be  fixed.