In a C# project I have a DLL reference that I want to remove before the build (to be replaced with another - this an attempted solution to Easily override NuGet DLL in development (VS 2015)). The following target seems to work:
<Target Name="BeforeBuild">
<ItemGroup Condition="Exists('..\..\..\Build\My.dll')">
<Reference Remove="My, Version=1.2.3.4, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="My, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Build\My.dll</HintPath>
</Reference>
</ItemGroup>
</Target>
The problem with this is that I need to specify the exact version of the DLL to remove, which can change. I want to remove it regardless of version. I tried a wildcard
<Reference Remove="My, Version=*, Culture=neutral, processorArchitecture=MSIL" />
... but that didn't seem to match anything, because I got error CS1704: An assembly with the same simple name 'My' has already been imported.