Skip to content
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

Emit clearer error for built-in tasks that don't work on .NET Core #3499

Closed
rainersigwald opened this issue Jul 10, 2018 · 8 comments · Fixed by #9153
Closed

Emit clearer error for built-in tasks that don't work on .NET Core #3499

rainersigwald opened this issue Jul 10, 2018 · 8 comments · Fixed by #9153
Assignees
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. .NET Core triaged

Comments

@rainersigwald
Copy link
Member

Not all tasks in Microsoft.Build.Tasks.Core.dll are present in .NET Core MSBuild; some weren't ported because of API limitations at the time and some just aren't done yet.

It'd be nice if you got a clear error indicating this, rather than a mysterious one like

C:\Program Files\dotnet\sdk\2.1.301\Microsoft.Common.CurrentVersion.targets(2725,5): error MSB4062: The "Microsoft.Build.Tasks.ResolveComReference" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  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.
@rainersigwald rainersigwald added .NET Core Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. labels Jul 10, 2018
@rainersigwald
Copy link
Member Author

This was done specifically for ResolveComReference in #3987. That model could be extended to all the tasks we don't build for Core.

Marking as up-for-grabs since we'd take contributions to build more stubs.

@rainersigwald rainersigwald added the help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. label Jan 17, 2019
@santoshyadavdev
Copy link
Contributor

Hi @rainersigwald,

Will take this up.

@rainersigwald rainersigwald removed the help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. label Mar 25, 2019
@kendrahavens
Copy link

A user on an unrelated ticket mentioned using the workaround documented here: https://stackoverflow.com/questions/47062203/net-core-error-on-build-error-msb4062-microsoft-build-tasks-resolvecomreferenc.
Should we have official guidance on this?

@rainersigwald rainersigwald added the help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. label May 17, 2021
@rainersigwald
Copy link
Member Author

@jrdodds
Copy link
Contributor

jrdodds commented Aug 14, 2023

@rainersigwald Please assign this issue to me.

Updated Notes:

I will create stubs for the following tasks based on how the ResolveComReference task was stubbed.

  • AL
  • AspNetCompiler
  • GenerateBootstrapper
  • GenerateTrustInfo
  • GetFrameworkSdkPath
  • RegisterAssembly
  • ResolveComReference
  • ResolveNativeReference
  • UnregisterAssembly
  • UpdateManifest
  • WinMDExp

Additionally, AppDomainIsolatedTask (base class of AppDomainIsolatedTaskExtension) is not used in ".NET Core MSBuild" and will be included in the Utilities project for '.NETFramework' only.

@jrdodds
Copy link
Contributor

jrdodds commented Aug 21, 2023

PR #3987 includes a change in ref/ (specifically in ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs) but ref/ is not a part of the public dotnet/msbuild repo.

Has the ref/ directory been replaced by dotnet/source-build-reference-packages (src/referencePackages/src/microsoft.build.tasks.core/17.4.0/ref/netstandard2.0/Microsoft.Build.Tasks.Core.cs)? It looks like there is an automated system for updating reference packages. How are changes made or propagated?

@rainersigwald
Copy link
Member Author

PR #3987 includes a change in ref/ (specifically in ref/Microsoft.Build.Tasks.Core/netstandard/Microsoft.Build.Tasks.Core.cs) but ref/ is not a part of the public dotnet/msbuild repo.

Has the ref/ directory been replaced by dotnet/source-build-reference-packages (src/referencePackages/src/microsoft.build.tasks.core/17.4.0/ref/netstandard2.0/Microsoft.Build.Tasks.Core.cs)? It looks like there is an automated system for updating reference packages. How are changes made or propagated?

The ref/ stuff has been replaced by .NET SDK-integrated package validation. For this specific change, the API surface should only increase (with the new-to-core types), which should not cause any errors. If you encounter errors highlight them in the PR and we can consider the best way forward (we can add exceptions if there's something that's technically breaking but reasonable to do).

@jrdodds
Copy link
Contributor

jrdodds commented Aug 23, 2023

The PR fails to build because base classes are different for the tasks.

rainersigwald pushed a commit that referenced this issue Sep 27, 2023
Following the pattern used for the `ResolveComReference` task, create stubs for .NET that provide a clear error message indicating the task is not supported on .NET.

Fixes #3499.
bulatgrzegorz pushed a commit to bulatgrzegorz/selective-condition-evaluator that referenced this issue Oct 16, 2023
Following the pattern used for the `ResolveComReference` task, create stubs for .NET that provide a clear error message indicating the task is not supported on .NET.

Fixes dotnet#3499.
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. help wanted Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim. .NET Core triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants