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

dotnet build fails #52

Closed
wolfkor opened this issue May 17, 2019 · 11 comments
Closed

dotnet build fails #52

wolfkor opened this issue May 17, 2019 · 11 comments
Assignees
Milestone

Comments

@wolfkor
Copy link

wolfkor commented May 17, 2019

I tried to use it with a dotnet build (2.1).
I get ...Brutal.Dev.StrongNameSigner.targets (6.5): error MSB4062: The Brutal.Dev.StrongNameSigner.AutomaticBuildTask Task could not be loaded from the ...\ .nuget \ packages \ brutal.dev.strongnamesigner \ 2.3.0 \ build \ Brutal.Dev.StrongNameSigner.dll assembly. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'. The system can not find the stated file....
Building locally within VS is working. Is it possible to build it with a newer Microsoft.Build.Utility reference ?

@brutaldev
Copy link
Owner

Do you have a sample project to replicate this failure? I suspect it's because the build task does not support and has not been tested outside of Visual Studio so using the new Core command line tools probably doesn't provide the probing paths as VS does.

@eyaldar
Copy link

eyaldar commented Jan 27, 2020

Any solution to this problem? I've been having the same problem.

@brutaldev
Copy link
Owner

@eyaldar Got a sample project with the commands you are using? Cannot debug and fix this if I cannot reproduce.

@mistial-dev
Copy link

mistial-dev commented Dec 4, 2021

I'm getting the same error trying to build.

Sample Project: gl.zip

My build environment is a bit unusual, I suspect. Dotnet 6, using Rider, on an ARM Macbook Pro.

Time Elapsed 00:00:01.18
mistial@Mistials-MacBook-Pro GreasedLightning % ~/.dotnet/dotnet build --configuration Release
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
/Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.targets(6,5): error MSB4062: The "Brutal.Dev.StrongNameSigner.AutomaticBuildTask" task could not be loaded from the assembly /Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.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. [/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.csproj]
/Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.targets(6,5): error MSB4062:  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. [/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.csproj]

Build FAILED.

/Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.targets(6,5): error MSB4062: The "Brutal.Dev.StrongNameSigner.AutomaticBuildTask" task could not be loaded from the assembly /Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.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. [/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.csproj]
/Users/mistial/.nuget/packages/brutal.dev.strongnamesigner/2.9.1/build/Brutal.Dev.StrongNameSigner.targets(6,5): error MSB4062:  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. [/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.91

@mistial-dev
Copy link

The assembly seems to be Microsoft.Build.Utilities.Core instead of a specific version.

mistial@Mistials-MacBook-Pro GreasedLightning % /Library/Frameworks/Mono.framework/Commands/monodis64 --assembly /Users/mistial/.dotnet/sdk/6.0.100/Microsoft.Build.Utilities.Core.dll
Assembly Table
Name:          Microsoft.Build.Utilities.Core
Hash Algoritm: 0x00008004
Version:       15.1.0.0
Flags:         0x00000001
PublicKey:     BlobPtr (0x000025c6)
	Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 
0x00000020: 07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D 
0x00000030: E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E 
0x00000040: B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90 
0x00000050: 0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F 
0x00000060: 29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1 
0x00000070: 64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D 
0x00000080: FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D 
0x00000090: 26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93 
Culture:

@brutaldev
Copy link
Owner

@mistial-dev There is currently a hard dependency on Microsoft.Build.Utilities.v4.0 because of the inheritance required for the automated build task and this is still being built for the full .NET Framework and not .NET Core.

image

I'll need to convert this project to .NET Core (was planning to anyway) and target multiple frameworks with build directives to use the correct utilities reference. Thanks for the sample project, I'll use this for testing 👍

@brutaldev brutaldev self-assigned this Dec 6, 2021
@brutaldev brutaldev added this to the 3.0.0 milestone Dec 6, 2021
@mistial-dev
Copy link

mistial-dev commented Dec 6, 2021

Appreciated.

We are doing cross platform development for an open source initiative, so we are trying to support as many platforms as possible.

It's security related, so we are hesitant to have things unsigned. If it comes to it we will recompile the upstream libraries, but this seems the more elegant solution, and I'm glad that you went through the effort to make it possible.

If there is anything on my side I can do to help test, please let me know.

@brutaldev
Copy link
Owner

brutaldev commented Dec 8, 2021

@mistial-dev Thanks. Almost done with the specific changes that fix this issue. I'll deploy a beta NuGet package you can bring into your project while I make the other fixes I want to for the official 3.1.0 release.

brutaldev added a commit that referenced this issue Dec 8, 2021
…encies to work in .NET Core only environments.

Fixes issue #52.
@brutaldev
Copy link
Owner

@mistial-dev
Please use the beta package with your project: https://www.nuget.org/packages/Brutal.Dev.StrongNameSigner/3.0.5-beta
Tried and tested with your sample project on a Mac, this was a lot tricker to get working cross-platform that I thought...

<PackageReference Include="Brutal.Dev.StrongNameSigner" Version="3.0.5-beta" />

@mistial-dev
Copy link

Thank you.

I just did a big project restructuring, so I'll need to re-add the references and set up a test. I'll let you know how it goes.

@mistial-dev
Copy link

Looks good. Thank you so much!

mistial@Mistials-MacBook-Pro GreasedLightning % dotnet build
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  -- Starting Brutal Developer .NET Assembly Strong-Name Signer Task --
  -- Starting Brutal Developer .NET Assembly Strong-Name Signer Task --
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.CLI/obj/Debug/net6.0/StrongNameSigner/Spectre.Console.dll' successfully.
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Util/obj/Debug/net6.0/StrongNameSigner/BouncyCastle.Crypto.dll' successfully.
  Invalid friend assemblies removed successfully from '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.CLI/obj/Debug/net6.0/StrongNameSigner/Spectre.Console.dll'.
  -- Finished Brutal Developer .NET Assembly Strong-Name Signer Task -- 00:00:13.3940328
  -- Finished Brutal Developer .NET Assembly Strong-Name Signer Task -- 00:00:13.3923705
  GreasedLightning.CLI -> /Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.CLI/bin/Debug/net6.0/GreasedLightning.CLI.dll
  GreasedLightning.Util -> /Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Util/bin/Debug/net6.0/GreasedLightning.Util.dll
  -- Starting Brutal Developer .NET Assembly Strong-Name Signer Task --
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/BouncyCastle.Crypto.dll' successfully.
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/GreasedLightning.Util.dll' successfully.
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/LiquidTestReports.Core.dll' successfully.
  Strong-name signature applied to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/LiquidTestReports.Markdown.TestLogger.dll' successfully.
  References to '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/LiquidTestReports.Core.dll' in '/Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/obj/Debug/net6.0/StrongNameSigner/LiquidTestReports.Markdown.TestLogger.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.VisualStudio.TestPlatform.Common.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CommunicationUtilities.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CommunicationUtilities.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CrossPlatEngine.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.VisualStudio.TestPlatform.Common.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CrossPlatEngine.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CommunicationUtilities.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/testhost.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.TestPlatform.CrossPlatEngine.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/testhost.dll' were fixed successfully.
  References to '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/Microsoft.VisualStudio.TestPlatform.Common.dll' in '/Users/mistial/.nuget/packages/microsoft.testplatform.testhost/16.11.0/lib/netcoreapp2.1/testhost.dll' were fixed successfully.
  -- Finished Brutal Developer .NET Assembly Strong-Name Signer Task -- 00:00:14.2463166
  GreasedLightning.Tests -> /Users/mistial/RiderProjects/GreasedLightning/GreasedLightning.Tests/bin/Debug/net6.0/GreasedLightning.Tests.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:31.80

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

No branches or pull requests

4 participants