如何测试 .net 程序所需的所有 .dll 是否可用?
我正在尝试测试加载 C++-CLI 程序所需的所有 .dll,以确保没有丢失任何一个,但是看起来简单的方法似乎不起作用:
// First make sure we have all the .dlls we need
Assembly^ assembly = Assembly::GetEntryAssembly();
array<System::Reflection::AssemblyName^>^ referencedAssemblies = assembly->GetReferencedAssemblies();
for each(System::Reflection::AssemblyName^ referencedAssemblyName in referencedAssemblies)
{
String^ strName = referencedAssemblyName->Name;
assembly->Load(strName);
}
...给了我一个例外其中表示无法加载文件或程序集“系统”或其依赖项之一。系统找不到指定的文件。
I'm trying to test-load all the required .dlls for a C++-CLI program to make sure none are missing, but what looked like a simple method to do this doesn't seem to work:
// First make sure we have all the .dlls we need
Assembly^ assembly = Assembly::GetEntryAssembly();
array<System::Reflection::AssemblyName^>^ referencedAssemblies = assembly->GetReferencedAssemblies();
for each(System::Reflection::AssemblyName^ referencedAssemblyName in referencedAssemblies)
{
String^ strName = referencedAssemblyName->Name;
assembly->Load(strName);
}
...gives me an exception which says Could not load file or assembly 'System' or one of its dependencies. The system cannot find the file specified.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
明白了:
不需要中间字符串:-)
Got it:
Didn't need the intermediate string in there :-)