問題描述
在沒有 app.config 的情況下在 .NET exe 中禁用驗證碼簽名驗證 (Disabling authenticode signature verification in .NET exe without app.config)
有誰知道如何在不使用應用程序配置文件的情況下禁用 .NET 可執行文件中的驗證碼簽名驗證(以避免啟動緩慢)?換句話說,這樣做:
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
沒有app.config。有可能嗎?
參考解法
方法 1:
If you are allowed to modify the Main() method, then what you could do is the following in your Main:
- Create an application config file in memory with generatePublisherEvidence
- Create a new application domain using the newly created application config file
- Run the original Main in the other application domain
This will allow you not to have an application config file, but be able to have all the customization you would want to have in the application config file.
方法 2:
Well, according to MSDN the element generatePublishersEvidence can only be used in a configuration file:
Configuration File
This element can be used only in the application configuration file.
See http://msdn.microsoft.com/en‑us/library/bb629393.aspx.
(by Joe Albahari、earlNameless、Dirk Vollmar)