我有一个程序集,在我自己的电脑上工作得很好,但是当我尝试在虚拟机上引用它时,我收到以下错误:
System.IO.FileNotFoundException: Could not load file or assembly 'X.dll' or one of its ependencies. The specified module could not be found.
File name: 'X.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at kernelLoader.Program.Main(String[] args)
我绝对确定该文件位于指定的位置,并且代码在我自己的机器上运行良好(它已被开发)。它与所有引用的程序集一起为 x86 平台编译。
我认为,该错误可能是由于程序集未被完全信任引起的。
我不能强唱程序集,因为它引用了几个程序集,这些程序集没有被唱过,而且我没有代码或修改的权利。
我怀疑有一种很好的方法可以让我运行它的机器上信任一个程序集。
如何将程序集标记为受信任,以便可以加载和执行它?