Problem:
I need to use FxCopCmd.exe (FxCop 10.0) from my code, and my problem is, that FxCopCmd gets my arguments (see below p.StartInfo.Arguments) with some encoding problem, I believe. (I have no experience in encoding, or localization.)
Example:
Arguments I build:
/o:"C:UsersÁkosDocumentsTanulásdiplomamunkasoftwareprojectqualityanalyserimplementációAnalizerAnalizerinDebug empprobaAnalisisReport.xml" /fo /f:"C:UsersÁkosDocumentsVisual Studio 2010ProjectsTeaBoilerTeaBoilerinReleaseTeaBoiler.exe"
FxCopCmd error message:
Could not open output file: Could not find a part of the path C:UsersµkosDocumentsTanul sdiplomamunkasoftwareprojectqualityanalyserimplement ci˘AnalizerAnalizerinDebug empprobaAnalisisReport.xml ..
Note:
If I use FxCopCmd.exe from cmd.exe using the arguments built by me using Edit/Paste, it works fine.
Development environment:
Windows 7 Prof EN, Default input language: Hungarian, .NET 4.0, C# 4.0, VS2010 Ultimate
Code:
using (Process p = new Process())
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = this.FxCop10Path.LocalPath;
string fullpath = Assembly.GetExecutingAssembly().Location;
string dir = Path.GetDirectoryName(fullpath);
p.StartInfo.Arguments = "/o:"" + dir + "\temp\" +
(this.ProjectName.Equals("") == true || this.ProjectName == null
? "noNameProjectAnalysisReport.xml" : this.ProjectName + "AnalisisReport.xml"")
+ " /fo";
foreach (var item in this.Files)
{
p.StartInfo.Arguments += " /f:"" + item.FilePath + """;
}
try
{
p.Start();
}
catch (Win32Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Thanks for any help!