如何更改程序集名称在C#编程 [英] How to change the Assembly Name in C# Programmatically
问题描述
我想在C#中改变我的编程大会的名称,有一种方法,通过它我可以从项目属性改变它,但我想以编程方式改变它,使我的输出.exe名称被改变。任何诀窍是什么?
I want to change the name of my Assembly Programmatically in C#, there is a way through which I can change it from Project Properties, but I want to change it Programmatically, so that my output .exe name is changed.. Any trick for that?
推荐答案
您可以在生成后事件做到这一点。这些脚本是后生成过程完成
You could do this in the Post-Build Event. These scripts are commandline scripts that get executed after the Build process finished
ren $(TargetFileName) new-filename.exe
编辑:
您可以通过配置Postbuild事件在Visual Studio中的项目并选择属性,单击鼠标右键。有你有一个名为Buildevents标签。有一个用于预生成,一个用于Postbuild。在底部你可以在脚本应该运行什么情况下选择。此说明假定您使用Visual Studio 2008中的活动也可在早期版本中,以及达到这些目标应该是相似的(对不起,不记得确切HOWTO)的方式。
You can configure the Postbuild Event by right-clicking on your Project in Visual Studio and selecting Properties. There you have a Tab called Buildevents. There is one for Prebuild and one for Postbuild. At the bottom you can select under what circumstances the Script should be run. This description assumes you are using Visual Studio 2008. The Events are also available in earlier versions, and the way to reach them should be similar (sorry, can't remember exactly howto).
这篇关于如何更改程序集名称在C#编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!