我正尝试在我的Windows Server200864位R2 (不是SP1)上使用以下代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Diagnostics;
using System.IO;
namespace TestWrite
{
class Program
{
static void Main(string[] args)
{
try
{
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\Windows\system32\Notepad.exe");
Console.WriteLine( "File: " + myFileVersionInfo.FileDescription + '\n' + "Version number: " + myFileVersionInfo.FileVersion);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Console.ReadLine();
}
}
}我收到这个错误信息: System.DllNotFoundException: Unable to load DLL 'version.dll':系统找不到指定的文件。
发布于 2012-08-28 21:05:13
请务必检查以下各项:
System.Diagnostics库通过执行以下代码来工作EventLog[] eventLogs = EventLog.GetEventLogs();foreach (EventLog E in eventLogs) { Console.WriteLine("{0}:",e.LogDisplayName);}
Any CPU或x86 .NET Framework 4.0是否正确安装?或者尝试重新安装。https://stackoverflow.com/questions/12159467
复制相似问题