I have solution in Xamarin.iOS with project that references very large DLL (binding for very large native library). So build time for solution is very large. After simple modification in any source file I need to wait for linking. So my idea was to exclude the reference from project using custom property and also to make define that I will use in .cs files to exclude code that depends on large assembly. But I'm unable to use custom condition to exclude the reference. The following strategy will not work for Xamarin.iOS (but will work in Visual Studio):
Create file CommonProperties.prop:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LinkWithLargeAssembly>True</LinkWithLargeAssembly>
</PropertyGroup>
</Project>
So the idea is: When it is not critical I can define LinkWithLargeAssembly as False and link my project fast. CommonProperties.prop can be imported in any assembly that depends on features of the large library.
In the project file .csproj import above file and try to exclude reference (for example monotouch):
...
<Import Project="CommonProperties.prop" />
...
<ItemGroup>
<Reference Include="monotouch" Condition=" '$(LinkWithLargeAssembly)' == 'True' " />
</ItemGroup>
...
I've tried also to define property $(LinkWithLargeAssembly) directly in the project file without import. Also I've tried to use already defined properties for example $(RootNamespace) and $(AssemblyName). But Condition attribute works only for properties $(Configuration) and $(Platform). That is following code will include and exclude monotouch depending on the configuration:
<ItemGroup>
<Reference Include="monotouch" Condition=" '$(Configuration)' == 'Debug' " />
</ItemGroup>
Is it possible to customize assembly reference including using my own conditional properties?