首页 > c# > C#VS2017社区 - 如何自动压缩项目的输出文件夹

C#VS2017社区 - 如何自动压缩项目的输出文件夹 (C# VS2017 Community - How to automatically ZIP the output folder of a project)

问题

有没有人知道在构建和将ZIP复制到另一个文件夹后自动压缩Debug / Release文件夹的方法?

解决方法

此解决方案将使用7-Zip将输出文件压缩到solutions文件夹。

创建此zipper.bat文件并将其放在解决方案文件夹中:

"C:\Program Files\7-Zip\7z" a -y -tzip %2 %1 -mx5

echo done

将此行添加到Post-build事件中:

call "$(SolutionDir)zipper.bat" "$(TargetDir)" "$(SolutionDir)zipped.zip"

问题

Does anyone know of a way easy way to automatically ZIP the Debug/Release folder after build and copy that ZIP to another folder?

解决方法

This solution will use 7-Zip to zip the output files to the solutions folder.

Create this zipper.bat file and place it in your solution folder:

"C:\Program Files\7-Zip\7z" a -y -tzip %2 %1 -mx5

echo done

Add this line to your Post-build events:

call "$(SolutionDir)zipper.bat" "$(TargetDir)" "$(SolutionDir)zipped.zip"
相似信息