New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failing with error MSB4062 (gets fixed with cache clean) #417

Closed
JuditRose opened this Issue Feb 7, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@JuditRose
Copy link
Member

JuditRose commented Feb 7, 2019

  • .NET Core Version: 3.0.100-preview-010024
  • Have you experienced this same bug with .NET Framework?: No

Repro:
Run build from command line (or terminal in VS code)
(with clean working directory, having successful builds before, same master head version building successfully on other machines)

Actual behavior: Build output:
E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(127,5): error MSB4062: The "CheckIfPackageReferenceShouldBeFrameworkReference" task could not be loaded from the assembly E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024
Sdks\Microsoft.NET.Sdk\targets..\tools\net46/Microsoft.NET.Build.Tasks.dll. Confirm that the 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. [E:\repos\winforms
\src\System.Design\src\System.Design.Facade.csproj]
E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(127,5): error MSB4062: The "CheckIfPackageReferenceShouldBeFrameworkReference" task could not be loaded from the assembly E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024
Sdks\Microsoft.NET.Sdk\targets..\tools\net46/Microsoft.NET.Build.Tasks.dll. Confirm that the 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. [E:\repos\winforms
\pkg\Microsoft.Private.Winforms.csproj]

Build FAILED.

E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(127,5): error MSB4062: The "CheckIfPackageReferenceShouldBeFrameworkReference" task could not be loaded from the assembly E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024
Sdks\Microsoft.NET.Sdk\targets..\tools\net46/Microsoft.NET.Build.Tasks.dll. Confirm that the 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. [E:\repos\winforms
\src\System.Design\src\System.Design.Facade.csproj]
E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(127,5): error MSB4062: The "CheckIfPackageReferenceShouldBeFrameworkReference" task could not be loaded from the assembly E:\repos\winforms.dotnet\sdk\3.0.100-preview-010024
Sdks\Microsoft.NET.Sdk\targets..\tools\net46/Microsoft.NET.Build.Tasks.dll. Confirm that the 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. [E:\repos\winforms
\pkg\Microsoft.Private.Winforms.csproj]
0 Warning(s)
2 Error(s)

image

Expected behavior: Build is successful.

It got fixed after these caches cleaned:

  • winforms\ .dotnet folder removed
  • winforms\artifacts folder removed
  • c:\Users\myuser\ .nuget folder removed
@merriemcgaw

This comment has been minimized.

Copy link
Member

merriemcgaw commented Feb 8, 2019

@JuditRose thank for the investigation and steps to fix this situation should it come up again.

@merriemcgaw merriemcgaw closed this Feb 8, 2019

@danmosemsft

This comment has been minimized.

Copy link
Member

danmosemsft commented Feb 8, 2019

I have no idea about this specific issue, but note that buildtools was never incremental with respect to the build tools, and I assume this did not change in the move to arcade tools. In other words, if your build pulls down updated tools, there is always a chance you need to do git clean -fdx and build again. I hope you would never need to clean the global cache though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment