맞춤/부호없는 DLL에 어셈블리 바인딩을 리디렉션합니다
-
06-07-2019 - |
문제
문제
기본 문제는 제 3 자 코드를 디버깅하여 작동 방식을 확인하여 일부를 대체 할 수 있다는 것입니다.
어쨌든 바인딩을 리디렉션하여 GAC에서 DLL을 사용하지 않고 대신에 편집 한 사본을 대신 서명하지 않거나 다른 공개 키가 있습니다).
세부
문제의 특정 항목은 ASP.NET MVC입니다. 그 이유는 GAC의 DLL 사본이 최적화되었으며 Microsoft 소스 서버의 소스 코드와 올바르게 일치하지 않기 때문입니다.
Microsoft는 ASP.NET MVC의 소스를 출시하여 다운로드하고 DLL을 직접 컴파일 할 수 있지만 분명히 키로 DLL에 서명 할 수는 없으므로 내 키로 서명 할 수 있지만 다른 공개 키 토큰이 있습니다. .
간단한 대답은 응용 프로그램에서 내 DLL을 참조하고 응용 프로그램을 다시 컴파일하는 것이지만 ASP.NET MVC (예 : MVCContrib)를 참조하는 다른 모든 제 3 자 DLL도 다시 컴파일해야합니다.
해결책
You can tune signing verification with the SN.EXE tool.
sn -Vr assembly
Unregister the original assembly from the GAC then put your own in the program's folder and use SN to skip verification.
다른 팁
I had similar problem to 'patch' a system with delay signed dlls/exes. Inspite of using sn -Vr *,[PublicKey]
it was failing with SecurityException: Strong name validation failed. Then, looking at the Registry locations: HKLM\Software\Microsoft\StrongName\Verification
and HKLM\Software\Wow6432Node\Microsoft\StrongName\Verification
it appeared it had some invalid entries. I removed the invalid entries, and then, used sn again (for 64/32 bit) and it worked like a charm.