Bug 42737 - Build error with XmlPoke: Not registered task XmlPoke
Summary: Build error with XmlPoke: Not registered task XmlPoke
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 4.4.0 (C7)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Ankit Jain
URL:
Depends on:
Blocks:
 
Reported: 2016-07-22 10:45 UTC by Aktar
Modified: 2017-09-05 01:36 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Aktar 2016-07-22 10:45:11 UTC
I have the following build target to increment build version number but it seems like xbuild does not implement XmlPoke

    <Target Name="BeforeBuild" Condition=" '@(InfoFile)' != '' AND '$(BuildIpa)' == 'true' ">
        <RemoveDir Directories="$(OutputPath);$(OutputDirectory);$(DebugDirectory)" />
        <XmlPeek XmlInputPath="@(InfoFile)" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]/text()">
            <Output TaskParameter="Result" PropertyName="BuildNumber" />
        </XmlPeek>
        <XmlPeek XmlInputPath="@(InfoFile)" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]/text()">
            <Output TaskParameter="Result" PropertyName="BundleShortVersion" />
        </XmlPeek>
        <XmlPoke
            XmlInputPath="@(InfoFile)"
            Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]"
            Value="$([MSBuild]::Add($(BuildNumber), 1))" />
        <Copy SourceFiles="@(InfoFile)" DestinationFiles="$(ProjectDir)\Info.plist" />
    </Target>

---

Errors:
                /Users/aktar/Documents/applications/src/mysolution/mysolution.sln (default targets) ->
                (Build target) ->
                /Users/aktar/Documents/applications/src/mysolution/MyProject/MyProject.csproj (default targets) ->
                (BeforeBuild target) ->
                    : error : Error initializing task XmlPoke: Not registered task XmlPoke.

---

about my Xbuild version :
XBuild Engine Version 14.0
Mono, Version 4.4.2.0
Comment 1 Rodrigo Kumpera 2016-07-23 00:16:47 UTC
Hi Aktar,

We're deprecating xbuild in favor of microsoft's xbuild.

Could you download mono 4.4.0 or 4.6.0 and try msbuild from them and see whether it works for your needs?
Comment 2 Rodrigo Kumpera 2016-07-23 00:17:48 UTC
I mean, we're deprecating in favor of microsoft's msbuild.

If you install mono 4.4.0 on OSX a msbuild command will be available.
Comment 3 Aktar 2016-07-27 08:36:24 UTC
This xbuild command allows me to build my project (it works) :
>xbuild ../Octet-International.sln /p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true

if I replace xbuild by msbuild
>msbuild ../Octet-International.sln /p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true

I have these errors:
"/Users/aktar/Documents/applications/src/octet-international/Octet-International.sln" (default target) (1) ->
"/Users/aktar/Documents/applications/src/octet-international/Octet.iOS/Octet.iOS.csproj" (default target) (2) ->
"/Users/aktar/Documents/applications/src/octet-international/Octet.ViewModels/Octet.ViewModels.csproj" (default target) (8) ->
(CoreCompile target) -> 
  ViewModels/Services/RegionViewModel.cs(305,47): error CS1929: Type `MvxPlugins.Geocoder.Address[]' does not contain a member `HasItem' and the best extension method overload `System.Collections.Generic.IListExtensions.HasItem(this System.Collections.IList)' requires an instance of type `System.Collections.IList' [/Users/aktar/Documents/applications/src/octet-international/Octet.ViewModels/Octet.ViewModels.csproj]
  ViewModels/Store/ProductsViewModel.cs(539,41): error CS1929: Type `System.Array' does not contain a member `Cast' and the best extension method overload `System.Linq.Enumerable.Cast<Octet.ViewModels.ViewModels.Enums.SortOptions>(this System.Collections.IEnumerable)' requires an instance of type `System.Collections.IEnumerable' [/Users/aktar/Documents/applications/src/octet-international/Octet.ViewModels/Octet.ViewModels.csproj]
Comment 4 Aktar 2016-07-27 10:07:29 UTC
if I add the "/m" swtich I have another error displayed after the one I posted earlier : 
>msbuild /m ../Octet-International.sln /p:Configuration=Release /p:Platform=iPhone /p:BuildIpa=true

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
This is an unhandled exception in MSBuild -- PLEASE OPEN A BUG AGAINST THE MSBUILD TEAM.
System.EntryPointNotFoundException: CreateProcess
  at Microsoft.Build.Execution.BuildManager.EndBuild () <0x51c3ef0 + 0x004df> in <filename unknown>:0 
  at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2 globalProperties, Microsoft.Build.Framework.ILogger[] loggers, LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary) <0x2a77bd0 + 0x00b77> in <filename unknown>:0 

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.EntryPointNotFoundException: CreateProcess
  at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2 globalProperties, Microsoft.Build.Framework.ILogger[] loggers, LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary) <0x2a77bd0 + 0x00e87> in <filename unknown>:0 
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) <0x67a3a0 + 0x0056b> in <filename unknown>:0 
This is an unhandled exception in MSBuild Engine -- PLEASE OPEN A BUG AGAINST THE MSBUILD TEAM.
System.EntryPointNotFoundException: CreateProcess
  at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2 globalProperties, Microsoft.Build.Framework.ILogger[] loggers, LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary) <0x2a77bd0 + 0x00e87> in <filename unknown>:0 
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) <0x67a3a0 + 0x0056b> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: CreateProcess
  at Microsoft.Build.CommandLine.MSBuildApp.BuildProject (System.String projectFile, System.String[] targets, System.String toolsVersion, System.Collections.Generic.Dictionary`2 globalProperties, Microsoft.Build.Framework.ILogger[] loggers, LoggerVerbosity verbosity, Microsoft.Build.CommandLine.DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, System.IO.TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary) <0x2a77bd0 + 0x00e87> in <filename unknown>:0 
  at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) <0x67a3a0 + 0x0056b> in <filename unknown>:0
Comment 5 Rodrigo Kumpera 2016-07-27 15:56:44 UTC
Ankit,

Can you take a look here?
Comment 6 malachi 2017-01-20 09:55:01 UTC
Hello, just checking if any progress on this? Or any workarounds? Or anything I can do to move it along? Cheers!
Comment 7 Aktar 2017-01-30 08:03:25 UTC
Hi Malachi, personally I'm using Cake now to build my projects, and the whole Xml file manipulation is done with Cake (cakebuild.net).
Best regards
Comment 8 malachi 2017-01-30 11:26:04 UTC
Thanks. I just ended up writing a clone of the XmlPoke Task and am including that dll in the build now. Simple workaround. Cheers!
Comment 9 christoph.rehmann 2017-02-01 11:28:10 UTC
@malachi would it be possible to upload your workaround somewhere?
Comment 10 malachi 2017-02-12 10:02:39 UTC
MSBuild is open source now so I just grabbed the XmlPoke task, renamed it to XmlPoker just to avoid any potential naming issues, and compiled it to a dll.

https://github.com/Microsoft/msbuild/blob/e5bc7994348dba88d1f6fe2ebd6aa354355f0063/src/Tasks/XmlPoke.cs

Then just import the task like any other:

<UsingTask
      TaskName="BuildUtils.XmlPoker"
      AssemblyFile="BuildUtils.dll" />
Comment 11 Ankit Jain 2017-09-05 01:36:43 UTC
According to comment #3, XmlPeek/Poke is working fine with xbuild. The error with msbuild is a compiler error and should be unrelated to XmlPeek/Poke. But I cannot reproduce that error as there is no test project included.

I tested the tasks with msbuild too and they work fine.

The error from comment #4 is because msbuild does not support parallel builds on mac yet. We emit an error message now, instead of that exception.

If you still run into issues with XmlPeek/Poke then please re-open the bug.