Configuration-Specific Settings in Visual Studio 2010
-
Hi, Does anyone know if it is possible to have, for example, a reference to an assembly in a debug build that is not present in the release build in Visual Studio 2010? In other words, to have assembly references set which are specific to a build configuration? On a closely-related issue, does anyone know if it is possible to have a file included in the project tree only for a specific configuration? If this isn't possible, is it at least possible to specify a different build rule for one configuration (e.g. have copy-to-output-directory only for the debug build and not the release)? I am struggling to find information on this, so any help or pointers-to-info would be very much appreciated. Best wishes, Patrick
-
Hi, Does anyone know if it is possible to have, for example, a reference to an assembly in a debug build that is not present in the release build in Visual Studio 2010? In other words, to have assembly references set which are specific to a build configuration? On a closely-related issue, does anyone know if it is possible to have a file included in the project tree only for a specific configuration? If this isn't possible, is it at least possible to specify a different build rule for one configuration (e.g. have copy-to-output-directory only for the debug build and not the release)? I am struggling to find information on this, so any help or pointers-to-info would be very much appreciated. Best wishes, Patrick
These things are quite possible. You will, however, need different MSBuild scripts to do this. Have two build scripts, build and release and call them based on a parameter. That should do it. It may actually just be possible to do this through the IDE itself - see http://visualstudiohacks.com/general/customize-your-project-build-process/[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick
-
These things are quite possible. You will, however, need different MSBuild scripts to do this. Have two build scripts, build and release and call them based on a parameter. That should do it. It may actually just be possible to do this through the IDE itself - see http://visualstudiohacks.com/general/customize-your-project-build-process/[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick
Added a batch file called Post Build to delete the unnecessary files. Works but feels like a real hack to me. Seems like a big limitation to me that you can't specify different build behaviour for a file depending on the configuration. Thanks for the help. Best wishes - Patrick
-
Hi, Does anyone know if it is possible to have, for example, a reference to an assembly in a debug build that is not present in the release build in Visual Studio 2010? In other words, to have assembly references set which are specific to a build configuration? On a closely-related issue, does anyone know if it is possible to have a file included in the project tree only for a specific configuration? If this isn't possible, is it at least possible to specify a different build rule for one configuration (e.g. have copy-to-output-directory only for the debug build and not the release)? I am struggling to find information on this, so any help or pointers-to-info would be very much appreciated. Best wishes, Patrick
Patrick Skelton wrote:
On a closely-related issue, does anyone know if it is possible to have a file included in the project tree only for a specific configuration?
As far as I am aware this is possible. Just use the project properties and change the settings for either the Release or Debug build as appropriate. I have definitely done something similar in the past with the Express Edition of VC++. The same should hold true for the copy you mentioned. The only problem I see here is that it is easy to get things messed up when you want to change any settings. An easier way is to create a second project within the solution that references only those source files necessary, and has all its settings totally independent of the original project.
Just say 'NO' to evaluated arguments for diadic functions! Ash
-
Patrick Skelton wrote:
On a closely-related issue, does anyone know if it is possible to have a file included in the project tree only for a specific configuration?
As far as I am aware this is possible. Just use the project properties and change the settings for either the Release or Debug build as appropriate. I have definitely done something similar in the past with the Express Edition of VC++. The same should hold true for the copy you mentioned. The only problem I see here is that it is easy to get things messed up when you want to change any settings. An easier way is to create a second project within the solution that references only those source files necessary, and has all its settings totally independent of the original project.
Just say 'NO' to evaluated arguments for diadic functions! Ash
Hi, Thanks for the answer. Not sure I can see how to do the first part of what you suggest. I can't see any way to exclude a file from just one project configuration. Your second idea is a good one though. I can't believe I didn't think of that myself. Doh! It's so obvious. Best wishes - Patrick
-
Hi, Thanks for the answer. Not sure I can see how to do the first part of what you suggest. I can't see any way to exclude a file from just one project configuration. Your second idea is a good one though. I can't believe I didn't think of that myself. Doh! It's so obvious. Best wishes - Patrick
Patrick Skelton wrote:
Not sure I can see how to do the first part of what you suggest. I can't see any way to exclude a file from just one project configuration.
Select the file then right-click to get the Properties dialog. Go to Configuration -> General and you can then exclude it from the build for the selected configuration only.
Just say 'NO' to evaluated arguments for diadic functions! Ash
-
Patrick Skelton wrote:
Not sure I can see how to do the first part of what you suggest. I can't see any way to exclude a file from just one project configuration.
Select the file then right-click to get the Properties dialog. Go to Configuration -> General and you can then exclude it from the build for the selected configuration only.
Just say 'NO' to evaluated arguments for diadic functions! Ash
Yes, got it - thanks. I have an assembly DLL getting copied that I don't want too, so I think the separate project idea is the way to go. - Patrick