2

I an ASP.NET Core application I need to copy some fonts to the output directory. In my project I store these fonts in the directory ProjectFolder/Assets.

In the properties of each font I have set CopyToOutputDirectory to Always.

When Visual Studio build the project, the files are copied to the same directory where project.exe is built. This is the behavior I expect.

But when I build the project using VSTS, the files are copied to a sub-directory named Assets, this is one level below than the exe.

How can I make VSTS copy the files to the same folder than the exe (as Visual Studio does).

Thank you in advance.

Victor
  • 23,172
  • 30
  • 86
  • 125
  • How are you building the project in VSTS? Can you share a screenshot of your build definition? Where do you notice this "the files are copied to a sub-directory named Assets"? Is this in the artifacts of your build? – Sander Aernouts Aug 06 '18 at 05:22
  • Add a "Copy Files to" step before you publish the files in the build pipeline. You can input the source and target directory. This may be a workarround but would do what you want. You can input the assets folder as source and copy them back into the main folder. – H.Mikhaeljan Aug 06 '18 at 05:40
  • Hi Patrick, I will try this in the weekend and I’ll let you know. Thanks! – Victor Aug 10 '18 at 02:51

1 Answers1

2

With TFS2017update1 and above, VSTS, you could simply check Flatten Folders under Advanced option in Copy Files Task. The easiest solution for now.

This option in "Advanced" section of "Copy Files" step of your build definition.

enter image description here

This will flatten the folder structure and copy all files into the specified target folder.

If this do not meet your requirement, you could try to use copy files step,take a look at this thread.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62