我有一个要求,我需要在构建解决方案文件后压缩一些文件。
一旦我在发布/ Debug模式下构建我的项目,这是否可以自动实现?
最佳答案
使用 powershell,仅在进行 Release build 时使用:
if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)*.dll', '$(TargetDir)*.pdb', '$(TargetDir)*.config' -DestinationPath ' $(SolutionDir)PublishOutput\YourNameHere.zip' -Force)
它只压缩dll、pdb和配置文件。
-Force
用于在每次构建时覆盖 zip 文件。
关于c# - 在 Visual Studio 中构建完成后压缩文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22710015/