【发布时间】:2013-12-27 09:57:43
【问题描述】:
发布 WPF 应用程序并生成 exe 时,我无法获取放置在模板文件夹中的文件。当我将文件夹和文件复制到 bin 时,它可以工作,或者如果使用
string StartUpPath = AppDomain.CurrentDomain.BaseDirectory.ToString();
// var gparent = Directory.GetParent(Directory.GetParent(Directory.GetParent(StartUpPath).ToString()).ToString()).ToString();
ReportDocument reportDocument = new ReportDocument();
StreamReader reader = new StreamReader(new FileStream(StartUpPath + @"\Templates\Invoice.xaml", FileMode.Open));
此代码在我的本地运行良好,但是当我生成 exe 时,找不到这些文件。
【问题讨论】: