例如,在我构建发布版本后,我希望将其名称更改为(例如)MyApp-1.2.exe。在构建下一个版本后,我希望将 exe 命名为 MyApp-1.3.exe。我仍然希望能够运行 MyApp-1.2.exe。
我宁愿不使用任何外部工具(我知道有 nAnt 和 nMaven),而是在 VS 中进行。如果不可能,我敢打赌 nAnt 对我来说是更好的选择。
最佳答案
您也可以在 GetAssemblyIdentity 的帮助下通过 MSBuild 完成此操作任务:
<GetAssemblyIdentity
AssemblyFiles="$(MSBuildProjectDirectory)\src\MyApp\bin\MyApp.exe">
<Output
TaskParameter="Assemblies"
ItemName="AssemblyIdentities"/>
</GetAssemblyIdentity>
然后重命名您的 .exe 文件:
<Copy
SourceFiles="$(MSBuildProjectDirectory)\src\MyApp\bin\MyApp.exe"
DestinationFiles="$(MSBuildProjectDirectory)\src\MyApp\bin\MyApp-(AssemblyIdentities.Version).exe"></Copy>
<Delete
Files="$(MSBuildProjectDirectory)\src\MyApp\bin\MyApp.exe"></Delete>
关于c# - 如何管理VS2010中的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4980484/