在Asp.net Core 1.0项目的编译时复制文件 [英] Copying files on compile for Asp.net Core 1.0 project

查看:188
本文介绍了在Asp.net Core 1.0项目的编译时复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Asp.Net Core 1.0创建REST Api,并且想要在编译项目时将项目中未包含的文件复制到输出路径.

I'm creating a REST Api with Asp.Net Core 1.0 and I want to copy a file which is not in included in the project to the output path when the project is compiled.

虽然我不知道该怎么做.我试图使用"buildOptions:copyToOutput"没有任何成功.我真的无法理解在这里找到的project.json参考: https://docs.microsoft.com/zh-cn/dotnet/articles/core/tools/project-json

I can't figure out how to do it though. I have tried to use "buildOptions: copyToOutput" without any success. I can't really understand the project.json reference found here: https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json

说我要将文件.... \ TestFolder \ Test.config复制到当前项目的输出文件夹中.我该怎么办?

Say that I want to copy the file ....\TestFolder\Test.config to the output folder of the current project. How can I do that?

推荐答案

您可以指定要在编译项目时复制到buildOptions中输出的文件.

You can specify files you want to copy to output in buildOptions when project is compiled.

"buildOptions": {
    "copyToOutput": [
       "../../../copyme.txt"
    ]
}

文件的路径是相对于project.json所在的文件夹的.就我而言:

The path to the file is relative to the folder where your project.json is residing. In my case:

Root folder:
-copyme.txt
-WebApplication\src\WebApplication\project.json

这篇关于在Asp.net Core 1.0项目的编译时复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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