novotnyllc / MSBuildSdkExtras

Extra properties for MSBuild SDK projects
MIT License
347 stars 42 forks source link

[Xamarin.MonoAndroid]: The "FilterAssemblies" task was not given a value for the required parameter "DesignTimeBuild" #173

Closed bruzkovsky closed 5 years ago

bruzkovsky commented 5 years ago

After updating to VS 16.2.0 (Windows), my release build fails with the following message:

MSB4044: The "FilterAssemblies" task was not given a value for the required parameter "DesignTimeBuild"

The .csproj is configured like this:

<TargetFrameworks>netstandard2.0;MonoAndroid81;Xamarin.iOS10;uap10.0.16299</TargetFrameworks>

My global.json:

{
    "msbuild-sdks": {
        "MSBuild.Sdk.Extras": "2.0.31"
    }
}

>>> Download Diagnostic Build Output

>>> Download VS Info

repro_xam_android_filterassemblies.zip

bruzkovsky commented 5 years ago

I also have a workaround (for my cake-script, but in essence it should work for every build setup):

// build.cake
// ....

Task("Build")
//.IsDependentOn ...
.Does(() =>
{
MSBuild(solution, settings => {
            settings.SetConfiguration(configuration);
            settings.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
            settings.WithProperty("version", version);
            // workaround bug in MSBuildSdkExtras / Xamarin.Android
            settings.WithProperty("DesignTimeBuild", "false");
        });
}

// ....

Maybe this helps someone.

Cheers

bruzkovsky commented 5 years ago

168 looks related.

tdcaesar commented 5 years ago

The same problem has been frustrating me. One way to determine if you have the same problem is to try and pack the project manually by setting '/p:DesignTimeBuild="false"' in the msbuild command. If it completes successfully, the congratulations, there is a solution. For example:

msbuild MY_Project.csproj /t:pack /p:DesignTimeBuild="false"

If you aren't using Cake, then you can also get around the issue by setting the DesignTimeBuild property to false. Just add it to an existing property group. Don't add it to an ItemGroup. I made this mistake thinking to use the existing Android conditional ItemGroup.

<PropertyGroup Label="Android DesignTimeBuild error workaround"> 
  <DesignTimeBuild>false</DesignTimeBuild>
</PropertyGroup>
clairernovotny commented 5 years ago

I can't seem to repro this in 16.3 preview 1. Does it happen for you there? If so, is there a small repro you can attach?

bruzkovsky commented 5 years ago

@onovotny here is my project, separated into a new solution: repro_xam_android_filterassemblies.zip

I can reproduce it by running a Release build. Debug works.

Edit: I will try to reproduce it on 16.3 preview 1 when I can free up some time

tdcaesar commented 5 years ago

You won't see it in debug because it only happens when you Pack. This project is set to pack on release and so you see the problem. If you set pack on build to false in release then it will finish successfully just like in debug.

bruzkovsky commented 5 years ago

@tdcaesar ok I see, thanks for pointing that out!

skarllot commented 5 years ago

@tdcaesar I cannot use your solution with #174 workaround.

ncunning commented 5 years ago

Have you tried adding

false

To the First of the affected csproj file.

skarllot commented 5 years ago

Yes, but your solution invalidate #174 workaround.

tdcaesar commented 5 years ago

@skarllot for #174 added Xamarin.Android.Support.Core.Utils Version 28.0.0.1 as workaround. That got rid of the Resource.Designer.cs not found issue and works with the DesignTimeBuild issue workaround. There was a comment about ResourceGen which should work, but caused a problem for me.

jamesmontemagno commented 5 years ago

I had an odd dependency on the new billing library and it has a dependency on annotations. I had to add the resgen fix and turn off designtime builds too: https://github.com/jamesmontemagno/InAppBillingPlugin/commit/1220af465fe6045cbf2b9e19b13909a0f0355523

clairernovotny commented 5 years ago

Can you try Extras 2.0.41? Should have a fix for this.

tdcaesar commented 5 years ago

Thank you, @onovotny . Version 2.0.41 works perfectly. I removed the workaround fixes, updated to 2.0.41, and all worked as it had before. Thank you for the fix.

bruzkovsky commented 5 years ago

Thanks, @onovotny, it works like a charm.