Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
Alias assemblies included in the same dll

I have a NuGet package that contains a series of assemblies that unfortunately all define the same type multiple times. Removing the duplicates is currently not an option as they are a product of generation. This yields a CS0433 compilation error like the following:

error CS0433: The type 'AmbiguousType' exists in both 'Assembly1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Assembly2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

I tried to address it by adding references to alias each of the assemblies like this:

<ItemGroup>
  <PackageReference Include="MyPackage" Version="1.0.0"/>
</ItemGroup>

<ItemGroup>
    <Reference Include="Assembly1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <HintPath>..\packages\netstandard2.0\assembly.dll</HintPath>
      <Aliases>Assembly1</Aliases>
    </Reference>
    <Reference Include="Assembly2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <HintPath>..\packages\netstandard2.0\assembly.dll</HintPath>
      <Aliases>Assembly2</Aliases>
    </Reference>
</ItemGroup>

then in the C# code I added the following to define the common type:

extern alias Assembly1;
using AmbiguousType = Assembly1::AssemblyNamespace.AmbiguousType;

but now I get a CS0430 that alias Assembly1 has not been referenced.

Is it possible to resolve this or is this something that just can't be done?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda