【问题标题】:How to merge external files within WinForms exe如何在 WinForms exe 中合并外部文件
【发布时间】:2016-08-25 05:47:35
【问题描述】:

我正在使用 winforms 设计一个脚本生成器。范围是生成少量更新/插入查询。我在我的项目中以.text 格式的文件夹中的更新/插入查询模板。

text = File.ReadAllText(@"\Visual Studio 2013\Projects\MigrationScript\MigrationScript\Scripts\Schema_OWNER.SYS_PARAMS.txt");
        text = text.Replace(Constants.LOWER_VER, lowerversion)
                   .Replace(Constants.CURRENT_VER, currentversion);
        System.IO.Directory.CreateDirectory(string.Format(Constants.DIRECTORY_CCB_SEED_OWNER, releaseVal));
        File.WriteAllText(string.Format(Constants.DIRECTORY_CCBOWNER_SYS_PARAMS, releaseVal), text);

它在我的机器中就像魅力一样。但是当我提取 .exe 并在另一台机器上运行时,我收到了类似System.IO.DirectoryNotFoundException: Could not find a part of the path 的错误

如何将项目中的外部文件包含到我的 .exe 中,以便我可以在任何机器上运行??相信我解释了我的问题。如果没有,请回复我。

【问题讨论】:

标签: c# .net winforms


【解决方案1】:

System.IO.DirectoryNotFoundException: Could not find a part of the path 明确指出无法从放置和运行 .exe 的系统访问路径。确保您提供的任何路径都应该可以从应该执行 .exe 的系统访问。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-27
    • 1970-01-01
    • 1970-01-01
    • 2014-01-05
    • 1970-01-01
    • 2017-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多