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

Hello world targeting .NET 5.0 master nightly fails to build using VS due to strong name validation failure #12082

Closed
Gnbrkm41 opened this issue Jun 16, 2020 · 9 comments
Labels
needs team triage Requires a full team discussion

Comments

@Gnbrkm41
Copy link

Gnbrkm41 commented Jun 16, 2020

(Very likely that I'm in the wrong repo, please feel free to move this to the correct repo if that is the case)

Currently I have 5.0.100-preview.7.20315.4 SDK Installed using the installer from the dotnet/installer repo. FWIW, I'm using one of the Windows 10 Pro Insiders (ko-KR, Fast ring, 19645) builds.

Using VS2019 Community 16.7 P2, I am unable to build a hello world project created using the default console app template.

ConsoleApp35.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

</Project>
Program.cs:
using System;

namespace ConsoleApp35
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}
Build log:
1>------ Build started: Project: ConsoleApp35, Configuration: Debug Any CPU ------
1>You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: File name: 'System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: The Zone of the assembly that failed was:
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: MyComputer
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.MachOUtils.RemoveSignature(String filePath)
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__RemoveSignatureIfMachO|2()
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func)
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom)
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore()
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute()
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018: 
1>C:\Program Files\dotnet\sdk\5.0.100-preview.7.20315.4\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(428,5): error MSB4018:
1>Done building project "ConsoleApp35.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The build process seemingly does nothing for about a minute... then it just fails with the error above.

Funnily enough... if I attempt this using dotnet build from CLI it seems to run just fine. This also happens with an other project of mine that also targets net5.0.

Attaching the binary log file from VS and CLI for comparison purposes. (Please remove the trailing .log extension, I had to change its extension because GitHub won't allow binlog files by default)
cli.binlog.log
vs.binlog.log

Any clues on troubleshooting would be appreciated.

@pr0vieh
Copy link

pr0vieh commented Jun 16, 2020

Same Problem!
i'm on Win10 Pro Version 2004 Insiders Release Preview (Build 19041.329)

@YeskaNova
Copy link

Same problem here.

@Gnbrkm41
Copy link
Author

Weird that I'm having the same problem with netcoreapp3.1... Maybe it's not specific to .NET 5.0 after all?

@pr0vieh, @YeskaNova - do you happen to experience the same problem targeting other framework versions?

@Gnbrkm41 Gnbrkm41 reopened this Jun 17, 2020
@Gnbrkm41
Copy link
Author

Oops

@YeskaNova
Copy link

@Gnbrkm41 If you have .net sdk 5.xx installed, you have to set in global.json a 3.xx version if you want to build a 3.xx project without having that problem. Otherwise you have to uninstall 5.xx sdk

@Gnbrkm41
Copy link
Author

Great, thanks for the additional information!

@pr0vieh
Copy link

pr0vieh commented Jun 18, 2020

Take a look at this...
dotnet/docs#18875

@Gnbrkm41
Copy link
Author

That doesn't appear to be related with this "strong name validation failure", no?

@marcpopMSFT marcpopMSFT added the untriaged Request triage from a team member label Jun 25, 2020
@sfoslund sfoslund added needs team triage Requires a full team discussion and removed untriaged Request triage from a team member labels Jun 26, 2020
@sfoslund sfoslund removed their assignment Jun 26, 2020
@Gnbrkm41
Copy link
Author

Looks like it's fixed in dotnet/runtime#38105. I cannot reproduce this issue on 5 P8.20326.16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs team triage Requires a full team discussion
Projects
None yet
Development

No branches or pull requests

5 participants