Problem: The.exe generated directory may not match the resource directory, so you can’t manually copy the generated.exe and DLL to the resource directory every time you compile the project
Solution: Use the build post batch command that comes with Visual Studio
visual studio-> Right-click project ->; properties-> Build Events-> Post-Build Event-> Under the Command Line
Xcopy $(OutDir) $(TargetFileName) $(ProjectDir.). \Resources
\/Y
This imperative function copies the exe files in the build directory to the Resources folder one level above the project directory
Note:
$outDir = $outDir = $outDir = $outDir
2. Generate post-event xcopy is simply running a console command, so
Command does not support ‘/’
Like an error command written earlier
Xcopy $(OutDir) $(TargetFileName) $(ProjectDir.).
/ Resources \/Y
Runtime will prompt an error
3. “/Y” is a parameter, indicating that there is the same file to replace
You can also copy the entire folder
Xcopy “$(ProjectDir) controls,” “$(TargetDir).. \ app1 \ controls “/ y/I/e/exclude: CodeFilesToExclude. TXT
For specific parameters, refer to the CMD console to see the specific function of xcopy…