Zip files after build completes in Visual Studio

前端 未结 3 1557
小鲜肉
小鲜肉 2021-02-02 12:38

I have a requirement where I need to zip some files after I build a solution file.

Could this be achieved automatically once I build my project in Release/Debug mode? <

3条回答
  •  自闭症患者
    2021-02-02 13:34

    Using powershell, only when doing Release build:
    if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)*.dll', '$(TargetDir)*.pdb', '$(TargetDir)*.config' -DestinationPath '$(SolutionDir)PublishOutput\YourNameHere.zip' -Force)

    It only zips the dll, pdb and config files.
    -Force is used to overwrite the zip file on each build.

提交回复
热议问题