[英]Include version number in exe file name in C# Visual Studio desktop application
I looked everywhere for a solution, and I think that it's impossible to do that ! 我到处都在寻找解决方案,我认为这是不可能的!
Can I include the version number (that is in AssemblyInfo.cs) into the .exe filename ? 我可以在.exe文件名中包含版本号(在AssemblyInfo.cs中)吗? So I don't have anymore to rename the output exe file every release build.
因此,我不再需要在每个发行版中重命名输出exe文件。
I just posted this question to be sure that in fact, it is impossible to do that. 我刚刚发布了这个问题,以确保实际上是不可能的。 Otherwise, if someone has a working solution I'll be happy to know it.
否则,如果有人有可行的解决方案,我将很高兴知道。 Thank you
谢谢
EDIT 编辑
I'm not searching how to get the assembly version, which I can find, but I'm looking for how to include that version automatically into my .exe output file name 我不是在搜索如何获取可以找到的程序集版本,而是在寻找如何将该版本自动包含到我的.exe输出文件名中。
I made it ! 我做到了 !
Thanks to Stinky Towel for that helpful comment. 感谢“ 臭毛巾 ”的有用评论。 I had to modify the script to make it run under my configuration, and as you can see I worked with wmic instead of filever which I couldn't find on Windows 10. Here is my script that worked fine:
我不得不修改脚本以使其在我的配置下运行,并且您可以看到我使用wmic而不是在Windows 10上找不到的filever。这是我的脚本,可以正常工作:
`@echo off
set filepath=%1
set filename=%2
set dblslash=%filepath:\=\\%
FOR /F "tokens=2 delims==" %%I IN (
'wmic datafile where "name='%dblslash%'" get version /format:list'
) DO SET "AssemblyVersion=%%I"
ECHO %AssemblyVersion%
move /Y %filepath% %filename%_%AssemblyVersion%.exe`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.