Copying files on compile for Asp.net Core 1.0 project

╄→尐↘猪︶ㄣ 提交于 2019-12-07 07:11:35

问题


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.

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

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


回答1:


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

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

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


来源:https://stackoverflow.com/questions/39749344/copying-files-on-compile-for-asp-net-core-1-0-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!