Visual Studio copy file to output directory

0

Hello

In my project I have an xml file and I want to copy this file to the output directory at compile time so that it gets along with the executable file and other files. For this I created a post-compilation event to copy this file to the output directory. But compiling is failing in the event. I'm almost sure it should be a file path-related error but I'm not sure.

Here'stheeventstatementI'mtrying:

copySqlCommands.xml$(OutDir)

Error:

GravidadeCódigoDescriçãoProjetoArquivoLinhaEstadodesupressãoErroThecommand"copy SqlCommands.xml ..\bin\Debug\" exited with code 1. FoxVideoManagerBackend C:\Program Files (x86)\MSBuild.0\bin\Microsoft.Common.CurrentVersion.targets 4714

    
asked by anonymous 20.09.2016 / 17:17

2 answers

1

In the file properties do not have the option to copy locally? It does what you need automatically

    
20.09.2016 / 18:32
1

According to this documentation , which I think applies to your case, This exited with code 1 is: No files were found to copy.

This command below is how I copy in a project of mine, it works perfectly here:

powershell -Command "xcopy '$(ProjectDir)Content\a\*' '$(ProjectDir)DIRPARACOPIA\Content\Content\a\' /s /e"

About correcting yours, I really can not seem to just use the question information, maybe the whole code will help more.

In any case, I'm going to point out that this "SqlCommands.xml" is not in the root directory where it runs the command, tries to put the whole path to SQL, or use $(ProjectDir) , etc.

    
20.09.2016 / 18:11