Publishing in release configuration gives this error:
Microsoft.Bcl.Build.targets(97,5): error MSB4062: The "EnsureBindingRedirects" task could not be loaded from the assembly ...\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll.
Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified. Confirm that the
<UsingTask>
declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
This is my publish command:
dotnet publish .\MyProject.csproj --runtime win10-x64
--self-contained --configuration release
- If I omit the configuration parameter the build is successful.
- Building with Visual Studio (msbuld) works with debug or release configurations.
This is a .Net 5 project that references projects that use .Net framework 4.7.2 projects.