<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="XmlPokeTest"> <XmlPoke etc.../> </Target> </Project>
... I get the dreaded task was not found message:
Microsoft (R) Build Engine Version 4.0.30319.1 Copyright (C) Microsoft Corporation 2007. All rights reserved. error MSB4036: The "XmlPoke" task was not found.
The error has a standard set of suggested solutions, including this one:
Check the following: 3.) The task is correctly declared within the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.0.50727" directory.
This works:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <UsingTask TaskName="Microsoft.Build.Tasks.XmlPoke" AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <Target Name="XmlPokeTest"> <XmlPoke etc.../> </Target> </Project>
There is a Microsoft.Commmon.Tasks file in the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder that lists the new MSBuild 4.0 tasks, like XmlPeek and XmlPoke. But MSBuild 4.0 is apparently still using the Microsoft.Commmon.Tasks file in C:\Windows\Microsoft.NET\Framework\v2.0.50727.
Using the toolsversion switch also works, presumably causing MSBuild to reference the new 4.0 Microsoft.Common.Tasks file:
msbuild /toolsversion:4.0 XmlPokeTest.proj
For future reference, the 4.0 Microsoft.Common.Tasks file includes these entries that are not included in the the 2.0 version:
AssignProjectConfiguration AssignTargetPath CreateCSharpManifestResourceName CreateVisualBasicManifestResourceName FindAppConfigFile FindInList FormatUrl FormatVersion GenerateTrustInfo GetReferenceAssemblyPaths Move RequiresFramework35SP1Assembly ResolveManifestFiles ResolveNonMSBuildProjectOutput UpdateManifest XmlPeek XmlPoke XslTransformation
No comments:
Post a Comment