首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ConfuserEx CLI没有指定输出目录

ConfuserEx CLI没有指定输出目录
EN

Stack Overflow用户
提问于 2017-10-19 07:03:58
回答 1查看 959关注 0票数 1

我对ConfuserEx CLI工具有一个问题。我想从这样的C#程序启动CLI:

代码语言:javascript
复制
System.Diagnostics.Process p = new System.Diagnostics.Process();

//p.StartInfo.RedirectStandardOutput = true;
//p.StartInfo.UseShellExecute = false;
//p.StartInfo.CreateNoWindow = true;

p.StartInfo.FileName = strConfuserExFilePath;
p.StartInfo.Arguments = strConfuserExProjectFilePath;

p.Start();

.Net\Diagramm\TEST\Haupt-Projekt\packages\ConfuserEx.Final.1.0.0\tools\Confuser.CLI.exe =D:\ strConfuserExFilePath示例 .Net\Diagramm\TEST\Haupt-Projekt\TEST\bin\x86\Debug\ConfuserEx.crproj =D:\ strConfuserExProjectFilePath示例

我的.crproj文件如下所示:

代码语言:javascript
复制
<project outputDir="D:\Examples .Net\Diagramm\TEST\Haupt-Projekt\TEST\bin\x86\Debug\Confused" baseDir="D:\Examples .Net\Diagramm\TEST\Haupt-Projekt\TEST\bin\x86\Debug" debug="false" xmlns="http://confuser.codeplex.com">
  <rule pattern="true" preset="normal" inherit="false">
    <protection id="anti ildasm" action="add" />
    <protection id="anti tamper" action="add" />
    <protection id="constants" action="add" />
    <protection id="ctrl flow" action="add" />
    <protection id="anti dump" action="add" />
    <protection id="anti debug" action="add" />
    <protection id="invalid metadata" action="remove" />
    <protection id="ref proxy" action="remove" />
    <protection id="resources" action="remove" />
    <protection id="rename" />
  </rule>
  <module path="h01_SonstVerwaltung.dll" />
</project>

当我运行该代码时,CommandBox显示得如此之快,以至于我无法读取错误。因此,我希望通过CommandLine启动CLI,看看会发生什么。当我做以下事情时:

代码语言:javascript
复制
D:\Examples .Net\Diagramm\TEST\Haupt.Projekt\packages\ConfuserEx.Final.1.0.0\tools>Confuser.CLI.exe D:\Examples .Net\Diagramm\TEST\Haupt-Projekt\TEST\bin\x86\Debug\ConfuserEx.crproj

我知道错误了

Confuser.Ex.CLI:未指定输出目录

奇怪的是,如果我运行相同的代码,但在PowerShell中,它可以工作:

代码语言:javascript
复制
function ObfuscateProjectAssembly
{
    [CmdletBinding()]
    param()    

    Utility_AssertValid_FilePath $ConfuserExFilePath
    Utility_AssertValid_FilePath $ConfuserExProjectFilePath

    if( Test-Path -Path $ObfuscatedAssemblyFilePath ) {
        Remove-Item -Path $ObfuscatedAssemblyFilePath
    }


    & $ConfuserExFilePath -nopause $ConfuserExProjectFilePath

    Utility_AssertValid_FilePath $ObfuscatedAssemblyFilePath    
}

为什么它适用于PowerShell,而不适用于C#。我已经尝试过在我的C#代码中添加-n个非滞后性参数。

编辑我尝试过从C#-代码执行PowerShell,但仍然带有相同的错误消息。

代码语言:javascript
复制
using (PowerShell PowerShellInstance = PowerShell.Create())
{
    PowerShellInstance.AddScript("& (\"" + strConfuserExFilePath + "\") -nopause " + strConfuserExFilePath);
    Collection<PSObject> PSOutput = PowerShellInstance.Invoke();

    if (PowerShellInstance.Streams.Error.Count > 0)
    {
        foreach(ErrorRecord er in PowerShellInstance.Streams.Error)
        {

        }
    }

    foreach (PSObject outputItem in PSOutput)
    {
        if (outputItem != null)
        {
            //System.Diagnostics.Debug.WriteLine(outputItem.BaseObject.GetType().FullName);
            System.Diagnostics.Debug.Write(outputItem.BaseObject.ToString() + "\n");
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-20 08:00:03

所以我发现了我的问题,很简单。我忘了“在.crproj文件周围”。

在这里,正确的方式:数字1通过过程:

p.StartInfo.Arguments = "-nopause \“+ strConfuserExProjectFilePath +”\“;

2号通过PowerShell:

PowerShellInstance.AddScript("& \\“+ strConfuserExFilePath + "\”-nopause \“+ strConfuserExProjectFilePath +”);

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46824316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档