views:

207

answers:

1

How can I specify a Condition for a COMReference in my *.csproj file? The following does not appear to work:

<COMReference Include="SomeComLib" Condition=" '$(Configuration)' == 'Debug' ">
    ...
</COMReference>

I have some COM references in a C# project in Visual Studio 2008. I would like them to automatically use non-isolation mode when I am in Debug, but automatically switch to Isolation mode when I make a Release build. I thought I could achieve this by specifying two different COMReferences in my *.csproj file, which are selected based on the Condition.

+1  A: 

I think your strategy should work, but if not, you could also move the Condition to the ItemGroup that encloses the ComReferences.

Brian
I discovered that I can even put the Condition on the Isolated element. Visual Studio does not update the value in the Properties pane when I switch between Debug and Release, but when I build it does the right thing.
emddudley