Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

.net - How to use a different assembly name for different configurations?

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 - in debug mode and just MyApp - in release mode

Does anyone know if this is possible?

Edit:

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've done this by messing with the .csproj file: either move the attribute into the configuration-specific property groups, or just use Condition. Example:

<AssemblyName>MyApp</AssemblyName>
<AssemblyName Condition=" '$(Configuration)' == 'Debug' ">MyAppDebug</AssemblyName>

Visual Studio becomes somewhat crippled when you start messing with .csproj like this - for example I can no longer F5/F10 to run the project in Debug mode; it tells me that "MyApp.exe" was not found (i.e. the debugger attempts to launch the assembly with the wrong AssemblyName).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...