How do i add dependencies to ASPX forms project? (nuget already tried)

0

I have worked with asp forms long time ago, now i must create a simple web interface, which uses powershell library.

[Nuget URI][1]https://www.nuget.org/packages/System.Management.Automation/

But seems impossible. using System.Management.Automation; <-- doesn't work any place.

Already tried installing the usual way (via cli and giu), copying the library to \bin folder and many other ways.

I often get the error:

Severity Code Description Project File Line Suppression State Error Could not load file or assembly 'System.Management.Automation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

I am trying Web Forms because of simplicity, hope i am missing a simple thing.

Any help will be appreciated.

c#
asp.net
webforms
asked on Stack Overflow May 4, 2020 by Garfius

1 Answer

0

It was a version incompatibility, as mason pointed out on 1st post comments. Use the OS library located on C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.x.x.x.x__xxxxxxxxxxxxxx

.net Framework aspx is getting complex, don't be fooled on other kind of projects or scripts where you can use any binary you can find.

I used "\sn.exe -Vr yourDll.dll", and "sn.exe -Vl" to register and check the nuget library to GAC but, i got another error:

Could not load file or assembly 'System.Runtime.Extensions

Seems i must use the actual OS library, otherwise it won't work.

Also tried creating custom libraries and workes (myClass1 worked), no GAC registry needed. Also tried downloading mysql official library, which registers, and worked.

Anyways, hope helps to someone.

answered on Stack Overflow May 4, 2020 by Garfius

User contributions licensed under CC BY-SA 3.0