Error initializing task PackageFilter: Not registered task PackageFilter. What does this mean?

FrederikFrederik USMember

So, whenever I try to build my solution I get the error: "Error: Error initializing task PackageFilter: Not registered task PackageFilter. (Name og project in solution)".
I have no clue how to solve this, the solution contains about 20 diffrent projects, the one specified in the message is a console app, the others are libraries, forms and websites. Please help. The solution works perfectly in visual studio on windows.

Answers

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai

    So, it sounds like this is a solution that was built in Visual Studio on Windows that you are trying to use on XS on OS X.

    That error message is stating that we tried to start building one of your projects, noted that the csproj is asking for a PackageFilter task, which xbuild knows nothing about (since whatever it is we don't appear to support), and fails.

    If you open up Errors Pad and click "Build Output", you can see the full build log and should be able to track down which csproj is causing you pain. You'll need to either fix the csproj to be compatible with mono or remove it from the solution at hand (unload, don't built in some build configuration, etc).

  • FrederikFrederik USMember

    It says so for all Projects in the solution. So Tamarin studio is not compatible with Visual Studio Solutions & Projects?

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai

    Not necessary, just maybe something special you are doing in your projects (Windows specific customizations?). You can open up your csproj files in a text editor to look for lines referencing PackageFilter.

    You could also post a csproj file here for us to look at if you want.

  • FrederikFrederik USMember

    Here it is, i does not contain the text "packageFilter":
    pastebin.com/SmAGG3nf#

  • FrederikFrederik USMember

    Note, in one of my projects I have an overloaded method, I call it like this "WriteLine("");":
    void WriteLine(string format, ConsoleColor foreColor = ConsoleColor.White, ConsoleColor backColor = ConsoleColor.Black, params object[] args)
    void WriteLine(string line, ConsoleColor foreColor = ConsoleColor.White, ConsoleColor backColor = ConsoleColor.Black)

    Xamarin studio gives me the error "The call is ambiguous between...", and it does not recognise the two overloaded methods properly, however Visual Studio does.

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai

    That last post (WriteLine) feels like a mono build.

    Feel free to file a bug against mono - https://bugzilla.xamarin.com

    I'll take a look at your pastebin shortly.

  • FrederikFrederik USMember

    Posted it here https://bugzilla.xamarin.com/show_bug.cgi?id=36384
    As for the working call (bottom of that post) Tamarin Studio thinks that the last param (ConsoleColor.Black) in "WriteLine("", ConsoleColor.Black, ConsoleColor.Black);" can be left out, and highlights it a bit faded out.

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai
    edited November 2015

    I'm wondering if your problem is "Baseclass.Contrib.Nuget.Output". That might be using msbuild trickery we don't have in xbuild. Try removing it:

    Import Project="..\packages\Baseclass.Contrib.Nuget.Output.2.1.0\build\net40\Baseclass.Contrib.Nuget.Output.targets" Condition="Exists('..\packages\Baseclass.Contrib.Nuget.Output.2.1.0\build\net40\Baseclass.Contrib.Nuget.Output.targets')" /

    and see if your get past that error.

  • FrederikFrederik USMember

    That fixed it :D
    Is this intended behaviour, or will it end up being fixed?

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai

    You can file a bug against mono's msbuild (https://bugzilla.xamarin.com) if you'd like, as a feature request. We'd have to add support for whatever msbuild APIs that nuget is using under the hood.

    I would not expect it to be fixed in the short/medium term even if you file a bug, so I'd work around it.

  • MikeNovaMikeNova USMember

    @ChrisHamons Hi, Chris!
    I have the same issue as Frederik. Was able to trace the error down to the package that was causing the error:
    src/packages/Xamarin.GooglePlayServices.Basement.60.1142.1/build/MonoAndroid80/Xamarin.GooglePlayServices.Basement.targets (SetupGoogleServicesJson target) ->

    Tried removing it from the csproj as per your instructions to Frederik (Import Project/Condition), but then I got another error:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_ResolveAssemblies target) ->

    : error : Could not load file or assembly 'NuGet.Common, Version=4.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
    

    at Xamarin.Android.Tasks.ResolveAssemblies.b__44_0 () [0x0000e] in <96027da06dd5411688a31011072e256f>:0
    at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2886
    at System.Threading.Tasks.Task.Execute () [0x00010] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2509

    Any ideas how to work around it?
    I'm on a mac, VS2017 Community

  • ChrisHamonsChrisHamons Xamurai USForum Administrator, Xamarin Team Xamurai

    Given your Android references, I assume this is an Android project. I would consider filing an issue here with them directly, as I know little about Android msbuild.

Sign In or Register to comment.