I have an ASP.NET MVC application, that needs to reference a number of assemblies that contain the same namespace and types, for example: ProductSdkBe.DLL, ProductSdkIt.DLL, etc. In fact, they are about the same assemblies with same types, but differ in implementation details.
I found that this could be done with 'extern alias' as described at two different DLL with same namespace, but it doesn't work. So what I did:
- From my ASP.NET MVC application, reference the assemblies
- For each assembly, set the alias (instead of the default global)
- Put extern alias on top of file
I always get error: 'The extern alias was not specified in a /reference option'.
I then tried the solution of The extern alias 'xxx' was not specified in a /reference option and added the following to the project file:
<Target Name="solveAliasProblem" >
<ItemGroup>
<ReferencePath Remove="D:\path\EC.ProductServices.Sdk_be.dll"/>
<ReferencePath Include="D:\path\EC.ProductServices.Sdk_be.dll">
<Aliases>ProductSdkBe</Aliases>
</ReferencePath>
</ItemGroup>
<ItemGroup>
<ReferencePath Remove="D:\path\EC.ProductServices.Sdk_it.dll"/>
<ReferencePath Include="D:\path\EC.ProductServices.Sdk_it.dll">
<Aliases>ProductSdkIt</Aliases>
</ReferencePath>
</ItemGroup>
but then it gives the error:
An assembly with the same simple name 'EC.ProductServices.Sdk, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side. EC.ProductServices.Sdk_be.dll.
What am I doing wrong?