在Asp.net Core 1.0项目的编译时复制文件

编程入门 行业动态 更新时间:2024-10-26 07:29:21
本文介绍了在Asp 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参考: docs.microsoft/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: docs.microsoft/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项目的编译时复制文件

本文发布于:2023-11-05 07:23:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560251.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   项目   net   Asp   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!