简体   繁体   English

使用 dotnet 模板创建空文件夹

[英]Create empty folder using dotnet template

I am using dotnet template to create template for my azure function using templates.config file.我正在使用 dotnet 模板为我的 azure function 使用 templates.config 文件创建模板。 It works fine but unable to create empty folder and throws when it creates solution from this template.它工作正常,但无法创建空文件夹并在从该模板创建解决方案时抛出。 I have empty folders in my template and would like to get it copied when we generate code from template.我的模板中有空文件夹,并且希望在我们从模板生成代码时复制它。 Is there a way that we can do.有没有我们可以做的方法。 Below is the image of how it displays as the folder Enums is not generated.下面是它在未生成文件夹 Enums 时如何显示的图像。

在此处输入图像描述

You can create empty folders with the help of placeholder files.您可以借助占位符文件创建空文件夹。 The steps are:步骤是:

  1. Name a placeholder filename in your template.json file在模板中命名占位符文件名。json 文件

    "placeholderFilename": ".keep" “占位符文件名”:“.keep”

  2. Create your folders and place an empty file named like the value of the previous variable (.keep in the example)创建您的文件夹并放置一个空文件,名称与前一个变量的值类似(示例中为 .keep)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM