在调试或发布控制台应用程序中创建文件夹 [英] Create folder inside debug or release con console application

查看:155
本文介绍了在调试或发布控制台应用程序中创建文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs2010(C#)和项目中都有一个控制台应用程序,我添加了一个文件夹(右键单击项目.. add->文件夹),并且在编译应用程序(调试或发布)时希望这样做),则将在debug或release目录中创建该文件夹(如果不存在)。

i have a console application in vs2010 (C#) and in the project, i have a Folder added by me (right click on project.. add->folder) and i want that when i compile the application (debug or release), then the folder will be created (if not exists) in the debug or release directory.

可能吗?

控制台应用程序是一个守护程序,可以访问数据库并发送在该文件夹中分配了模板的电子邮件。

The console application is a daemon that access to a database and send emails with templates allocated in that folder.

希望您能对我有所帮助。谢谢!

I hope you can help me. Thanks!

推荐答案

我解决了这个问题,就像这样:csproj中的

I solve it, like this: in the csproj:

<Target Name="AfterBuild">
    <MakeDir Directories="$(OutDir)EmailTemplates" Condition="!Exists('$(OutDir)EmailTemplates')" />
    <ItemGroup>
      <Templates Include="$(ProjectDir)EmailTemplates\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(Templates)" DestinationFolder="$(OutDir)EmailTemplates" />
  </Target>

感谢您的帮助!

这篇关于在调试或发布控制台应用程序中创建文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆