VS2008 - Outputting a different file name for Debug/Release configurations

后端 未结 3 1067
迷失自我
迷失自我 2020-12-15 17:25

When building a C# application with Visual Studio 2008, is it possible to set a different output filename per configuration?

e.g.

MyApp_Debug.exe
MyApp_Rele         


        
3条回答
  •  既然无缘
    2020-12-15 18:19

    You can achieve this by editing your project file by hand. Locate the node and add a conditional attribute to it:

    MyApp_Debug.exe
    MyApp_Release.exe
    

    You'll have to duplicate it also to add another conditional attribute for the release version.

    Whilst it is possible, it may cause problems. There is an AssemblyConfiguration attribute that can be applied to your assembly. In AssemblyInfo.cs, put:

    #if DEBUG
    [assembly: AssemblyConfiguration("Debug")]
    #else
    [assembly: AssemblyConfiguration("Release")]
    #endif
    

    This will add a property to your compiled assembly that will tell you which build configuration your application was built using.

提交回复
热议问题