从网络位置加载程序集 [英] Loading assemblies from a network location

查看:411
本文介绍了从网络位置加载程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Fody / Costura将我的所有DLL打包成一个可以发给用户的可执行文件。



我尝试过:



我使用Nuget安装了软件包但是当我尝试构建项目时,在构建项目时出现以下错误;



Im trying to use Fody/Costura to package all my DLLs into one executable that I can give out to users.

What I have tried:

I've installed the package using Nuget but when I try to build my project I get the following error when building the project;

System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. 
    This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. 
    If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch.





我在网上进行了一些研究,包括查看微软网站,最终把它放到我的app.config文件中(格式正确,我无法在这个论坛上练习如何做到这一点);



运行时间

loadFromRemoteSources enabled =true

运行时间



但是我尝试构建时仍然收到错误消息。



I did some research online including looking at the Microsoft website and eventually ended up putting this into my app.config file (with the correct formatting, I couldn't workout how to do that on this forum);

runtime
loadFromRemoteSources enabled="true"
runtime

However I still get the error message when I try to build.

推荐答案

请阅读:更多CAS隐式使用策略:loadFromRemoteSources - .NET安全博客 [ ^ ]

你会发现如何解决它的方法。
Please, read this: More Implicit Uses of CAS Policy: loadFromRemoteSources – .NET Security Blog[^]
There you'll find a way how to workaround it.


这篇关于从网络位置加载程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆