我正在开发一个可以解释和使用API蓝图的工具。
我创建了一个新的控制台应用程序,添加了SnowCrash.NET nuget包并编写了以下代码:
static void Main(string[] args)
{
snowcrashCLR.Blueprint blueprint;
snowcrashCLR.Result result;
var path = args.Length > 1 ? args[1] : @"c:\";
snowcrashCLR.SnowCrashCLR.parse(path, out blueprint, out result);
if (result != null)
{
var warnings = result.GetWarningsCs();
foreach (var warning in warnings)
{
Console.WriteLine("{0}: {1}", warning.code, warning.message);
}
}
}
当我将代码(复制到bin文件夹中)部署到与开发环境不同的计算机上时,我得到一个FileNotFoundException指向SnowCrash.dll
这是错误消息中的快照商店:
无法加载文件或程序集“ snowcrashCLR.DLL”或其依赖项之一。指定的模块无法找到。
[FileNotFoundException: Could not load file or assembly 'snowcrashCLR.DLL' or one of its dependencies. The specified module could not be found.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
加载映像C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ Microsoft.VisualC.STLCLR \ v4.0_2.0.0.0__b03f5f7f11d50a3a \ Microsoft.VisualC.STLCLR.dll
MS Visual C++ 2005 Redist (x64)
MS Visual C++ 2008 Redist (x64) 9.0.30729.4148
MS Visual C++ 2008 Redist (x64) 9.0.30729.6161
MS Visual C++ 2008 Redist (x86) 9.0.30729.4148
MS Visual C++ 2008 Redist (x86) 9.0.30729.6161
MS Visual C++ 2010 x64 Redist - 10.0.40219
MS Visual C++ 2013 x64 Redist - 12.0.30501
MS Visual C++ 2013 x86 Redist - 12.0.30501
在出现错误(未运行)的计算机上,我安装了与上面相同的运行时列表,但是并没有解决问题或无法正常工作。
我在该计算机上安装了Visual Studio,该计算机以前无法运行,当我尝试我的应用程序后它可以正常工作
通过在网络之间进行大量挖掘,我发现SnowCrash DLL运行时需要缺少依赖项,该依赖项是Visual C ++运行时2012 x86。
由于它是混合的(托管CLR +本机)DLL,因此需要VC ++运行时附带的C ++ MFC库。并且它必须是正确的版本才能正常运行。
从此MSDN URL将运行时安装到目标计算机上解决了我的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句