Disabling PlatformVerificationTask for CompactFramework projects
So I’ve been working a lot with setting up Hudson to build our applications. I ran into some issues that I’d like to share.
When running on Hudson Windows Machines, it becomes quite easy to reach a PathToLongException
, when building larger projects. This can cause other side effects such as MSBuild saying that it cant find the specified files, or that the CompactFramework builds fail with the PlatformVerificationTask
.
We’ve been having issues under TFS that the PlatformVerificationTask
failed occasionally for no apparent reason. So when it started to fail in Hudson we decided to just turn it off.
Before actually turning it off its important to know what it does. The platform verification task is a static code analysis tool that points out when you use parts of the .Net framework that are not supported in the compact framework.
Platform Verification Task (PVT) is a post-build validation step to catch the unsupported PMEs before they can result in a runtime exception.
Mobile dev group, Visual Studio for Devices
There are two options for turning the PlatformVerificationTask
off.
One is to make changes to the Microsoft.CompactFramework.Common.Targets
file as outlined in this article quoted above. This causes the PlatformVerificationTask to be configurable on that machine only. However that targets file doesn’t follow to project. So that change wont be checked in and follow your project.
Instead what we settled on was to override the PlatformVerificationTask in our .csproj
files.
Add the following target to the end of each compact framework csproj:
<Target Name="PlatformVerificationTask"></Target>
This overrides the platform verification task target, and causes it to never be run. A slightly less offensive approach is to copy the original task form the Microsoft.CompactFramework.Common.Targets
file and simply add the override on a per project basis.