1

I have a C# exe which is referring to some other dlls and the dlls are signed using a strong name key. It works fine when I execute this in my local system. But when I call the same exe from Azure release pipeline, it is giving me the below error.

System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

I tried sn.exe -Vr "dll path" for all the referred dlls. And also tried the command bypassTrustedAppStrongNames enabled="false" & "true" within the exe's app.config. But both didn't help.

Can anyone please suggest a solution for this. Thanks in advance.

Tinz
  • 123
  • 1
  • 9

3 Answers3

1

You can try to search for System.Management.Automation reference in the csproj file and replace that with <Reference Include="System.Management.Automation" />

For this ,please refer to this case with similar issue.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
0

You can try to disable the strong name validation in an application level by adding the following snippet in an Application Configuration File

<configuration>  
  <runtime>  
    <bypassTrustedAppStrongNames enabled="true" />  
  </runtime>  
</configuration>  

For more info you can take a look in Microsoft documentation page

Stelios Giakoumidis
  • 2,153
  • 1
  • 7
  • 19
  • 1
    Hi Stelios, Already tried this, but it didn't help. As mentioned, locally it works fine, but when it call from the pipeline it gives error. – Tinz May 22 '20 at 02:53
  • @Tinz habe you tried to disable it on a server level? as it is discribed in the Microsoft's documentation page I attached to you? Disable the strong-name bypass feature for all applications - Subtopic – Stelios Giakoumidis May 22 '20 at 13:03
0

I'm not sure you will have permissions to skip validation on a hosted agent. So you can either make your own agent or

  • Remove the strong name of the dependencies or rebuild them with no strong name.
  • Sign your application.
  • 1
    I have added "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\sn.exe" -Vr "{dll Path}" in the hosted agent commandline task before calling exe and it is showing 'Verification entry added for assembly', but again it is showing Strong name validation failed. – Tinz May 22 '20 at 10:38
  • Skipping verification is a local workaround. Strong name sign your assemblies. – David Watson May 24 '20 at 02:30