Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

845
Views
Extensibilidad VS2022: cómo resolver "El tipo 'XXX' existe tanto en 'Ensamblaje 1' como en 'Ensamblaje 2' en la ejecución de la plantilla T4

Tengo una extensión que estoy actualizando de VS2019 a VS2022. Es un DSL que usa Modeling SDK y tiene generación de código a través de plantillas T4.

Lo tengo bastante convertido pero, cuando ejecuto los T4, obtengo

 Compiling transformation: The type 'SourceControl' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'Project' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'Constants' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'ProjectItem' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'ProjectItems' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'DTE' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Compiling transformation: The type 'Solution' exists in both 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

y no puedo encontrar la manera de resolver esto.

No incluyo esos ensamblajes en mi archivo .tt principal, ni se hace referencia a ellos en mis proyectos Dsl o DslPackage , pero entiendo por otros errores que tuve que resolver que EnvDTE8.0 y Microsoft.VisualStudio.Interop están implícitamente disponibles como parte del entorno ambiental VS2022. Como no forman parte de mis proyectos, no puedo usar el mecanismo de Alias de Visual Studio para eliminar la ambigüedad.

He leído las otras preguntas sobre SO con respecto a problemas similares, pero ninguno de ellos es este problema y sus soluciones realmente no se aplican.

Gracias por cualquier ayuda o dirección que alguien pueda dar.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Me encontré con un problema similar hoy con mis plantillas T4. Después de mirar tu publicación y pensar en ella durante un par de minutos, probé lo siguiente

Encontré el archivo que agregaba el ensamblado EnvDTE

 <#@ assembly name="EnvDTE"#>

y lo cambié a

 <#@ assembly name="Microsoft.VisualStudio.Interop"#>

y eso resolvió mi problema.

over 4 years ago · Santiago Trujillo Report

0

intente eliminar el ensamblaje EnvDTE.

 <#@ assembly name="EnvDTE"#>

pero el siguiente código sigue siendo válido:

 <# EnvDTE.DTE dte = (EnvDTE.DTE) ((IServiceProvider)this.Host).GetService(typeof(EnvDTE.DTE));#>

y uso VS2022.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!