问题:
我需要在我的代码中使用FxCopCmd.exe (FxCop 10.0),我的问题是,我相信FxCopCmd通过一些编码问题来获取我的参数(参见下面的p.StartInfo.Arguments)。(我没有编码或本地化方面的经验。)
示例:
我建立的参数:
Visual Studio 2010\Projects\TeaBoiler\TeaBoiler\bin\Release\TeaBoiler.exe“:”C:\Users\Users\Documents\ /o:"C:\Users\Ákos\Documents\Tanulás\diplomamunka\softwareprojectqualityanalyser\implementáció\Analizer\Analizer\bin\Debug\temp\probaAnalisisReport.xml“/fo /f
FxCopCmd错误消息:
无法打开输出文件:找不到路径C:\Users\µkos\Documents\Tanul s\diplomamunka\softwareprojectqualityanalyser\implement和ci˘\Analizer\Analizer\bin\Debug\temp\probaAnalisisReport.xml‘..的一部分
注意:
如果我使用cmd.exe中的FxCopCmd.exe,并使用我通过编辑/粘贴构建的参数,它可以正常工作。
开发环境:
C# 7教授EN,默认输入语言:匈牙利语、.NET 4.0、Windows 4.0、VS2010旗舰版
代码:
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);
}
}谢谢你的帮助!
发布于 2011-02-23 04:58:24
尝试在设置参数后立即中断。查看它正在生成的内容,然后将其复制并粘贴到cmd窗口中,看看发生了什么。另外,'temp‘文件夹是否存在?如果不是,您确定是FxCop创建的文件夹吗?
https://stackoverflow.com/questions/5058510
复制相似问题