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

SignFile task referenced, but not provided, in Microsoft.Build.Tasks.Core #6098

Closed
Zastai opened this issue Jan 19, 2021 · 7 comments · Fixed by #6509
Closed

SignFile task referenced, but not provided, in Microsoft.Build.Tasks.Core #6098

Zastai opened this issue Jan 19, 2021 · 7 comments · Fixed by #6509
Labels
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
Milestone

Comments

@Zastai
Copy link
Contributor

Zastai commented Jan 19, 2021

When using dotnet build, attempting to sign assemblies results in

error MSB4062: The "Microsoft.Build.Tasks.SignFile" 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.

It is declared in Microsoft.Common.tasks:

    <UsingTask TaskName="Microsoft.Build.Tasks.SignFile"                              AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="'$(MSBuildAssemblyVersion)' != ''" />

It looks like the task is only present in the .NET Framework version of the assembly, not in the standard/core version.

Oddly, the backend signing methods ARE present in the core assembly (SecurityUtilities.SignFile()), so there does not seem to be any reason to omit the task.

The task should be added to the standard/core assembly too; on non-Windows it can fail with PNSE, but on Windows it should work with dotnet build the same way it does with msbuild.

If that is not possible, it should still be added so that it can give a useful error rather than MSB4062, because that suggests user/configuration error.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@OndrejHlavka
Copy link

We're running into the same issue.

@dsplaisted
Copy link
Member

Moving to MSBuild. It's possible that the functionality to implement this was not available when MSBuild was originally ported to .NET Core, but is now available in more recent versions.

@dsplaisted dsplaisted transferred this issue from dotnet/sdk Jan 29, 2021
@dsplaisted dsplaisted removed their assignment Jan 29, 2021
@dsplaisted dsplaisted added the needs-triage Have yet to determine what bucket this goes in. label Jan 29, 2021
@j5aenz
Copy link

j5aenz commented Feb 21, 2021

I am currently having this issues as well. I have tried to publish using other methods and this is the most descriptive message. so far. It does look like a compatibility issue between net5 and msbuild. i am targeting net5-windows10.0.19041.0.

@benvillalobos
Copy link
Member

@sujitnayak is it reasonable to enable this task on .NET Core on Windows?

@benvillalobos benvillalobos removed the needs-triage Have yet to determine what bucket this goes in. label May 19, 2021
@sujitnayak
Copy link
Contributor

sujitnayak commented May 26, 2021

Yes it should be reasonable to support this during build. For ClickOnce publish that also calls SignFile, we don't support the dotnet CLI yet.

@benvillalobos benvillalobos added this to the Backlog milestone Jun 2, 2021
@benvillalobos benvillalobos added 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 labels Jun 2, 2021
@benvillalobos
Copy link
Member

Team Triage: Since there are some scenarios that won't be supported, we can enable SignFile. We're open to taking a PR as this isn't high priority for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

7 participants