如何为不同的配置使用不同的程序集名称? [英] How to use a different assembly name for different configurations?

查看:25
本文介绍了如何为不同的配置使用不同的程序集名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 2008(和其他)中创建 .NET 或 Silverlight 应用程序时,如果您查看您的项目属性,似乎您只能有一个程序集名称 - 跨所有配置.我想将我的应用程序编译为:

In Visual Studio 2008 (and others) when creating a .NET or silverlight application if you look at your project properties, it seems like you can only have one assembly name - across all configurations. I would like to compile my application as:

MyAppDebug - 在调试模式并且只是MyApp - 处于发布模式

MyAppDebug - in debug mode and just MyApp - in release mode

有人知道这是否可能吗?

Does anyone know if this is possible?

似乎有些人在质疑问题背后的推理,所以我将进一步解释:

It seems some people are questioning the reasoning behind the question, so I'll explain a little further:

我正在开发一个 Silverlight 应用程序,当我进入构建解决方案"时,该应用程序会自动上传到我们的测试站点.问题是,测试团队现在正在测试在线版本,而我正在开发一个新版本.所以,我想要一个像 .MyApp.html 这样的 url 用于 QA 团队将测试的常规版本,然后 .MyApp.html?version=debug 用于我正在处理的当前版本.

I'm working on a Silverlight application which gets automatically uploaded to our test site when I to a "build solution". The trouble is, the test team are now testing the online version, whilst I work on a new one. So, I want to have a url like .MyApp.html for the regular version that the QA team will test and then .MyApp.html?version=debug for the current version that I'm working on.

推荐答案

我通过使用构建后脚本设法实现了我想要的:

I've managed to achieve what I was after by using a post-build script:

if "$(ConfigurationName)"=="Debug" goto debug
"$(SolutionDir)ftp.bat" "$(TargetDir)$(TargetName).xap"
:debug
"$(SolutionDir)ftp.bat" "$(TargetDir)$(TargetName).xap" "$(TargetDir)$(TargetName)Debug.xap"

我的 ftp 脚本基本上在最后接受一个可选参数,即上传文件的内容.所以在我的本地机器上,文件名总是相同的,但在调试模式下,我们在文件名末尾使用Debug"上传它.现在我可以在我的网页中选择要显示的版本.

My ftp script basically accepts an optional parameter at the end which is what to upload the file as. So on my local machine the filenames are always the same, but in debug mode we upload it with "Debug" at the end of the filename. Now I can choose in my webpage which version to show.

这篇关于如何为不同的配置使用不同的程序集名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆