FileVersionInfo no funciona en Win2008 R2
Frecuentes
Visto 181 veces
0
I am trying to use following code on my Windows Server 2008 R2 64-bit (not 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();
}
}
}
I get this error message: System.DllNotFoundException: Unable to load DLL 'version.dll': The system cannot find the file specified.
1 Respuestas
1
Be sure to check the following:
Programas de
System.Diagnostics
library works by executing this codeEventLog[] eventLogs = EventLog.GetEventLogs(); foreach (EventLog e in eventLogs) { Console.WriteLine("{0}:", e.LogDisplayName); }
Me gusta David W points out, check the solution platform (
Any CPU
orx86
víaSolution Configuration Manager
)Es el
.NET Framework 4.0
is installed properly? Or try a re-install.
contestado el 23 de mayo de 17 a las 11:05
I'm missing the connection the first bullet point has to the question. - Jesse C. Rebanadora
The first bullet point was another test case to check the framework - Bart
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas .net windows-server-2008-r2 or haz tu propia pregunta.
Is this a 64-bit or 32-bit application? - David W
In V.S., platform target is set to 'Any CPU'. - Knaks
Just for grins, recompile your application and change the target to X86, which should force the target into a 32-bit application. If the error persists, I'd check for the presence of \windows\system32\version.dll on the target machine. - David W