New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple conflicts with Microsoft.VisualStudio.Interop in VS2022 #136
Comments
Maybe they changed something. Can you try to figure out the root cause and propose solution? |
Looks like, so far a straightforward fix may work, e.g. instead of SVsQueryEditQuerySave use Microsoft.VisualStudio.Shell.Interop.SVsQueryEditQuerySave |
I see, and I assume same for In the meantime, people will hopefully find this issue and work around! |
I tried that, but still get the error. Was there something else you did? |
I fixed this by removing the assembly imports of I should note I did this in T4MVC v3.17.4, so your mileage may vary with newer versions. |
I resolved it in addition to removing the assembly imports of EnvDTE, EnvDTE80, and Microsoft.VisualStudio.Shell.Interop what adamjford says, adding the Microsoft.VisualStudio.Sdk nuget package to the project, but too many unnecessary dependencies are created and I do not like the solution. |
The issue disappeared in Visual Studio 2022 ver. 17.1.4. No template code change is required. |
I am getting this issue and on 17.1.4, can't generate code with 2022 update. |
I have just updated to 17.1.4 and I am getting same error |
I removed these in the T4MVC.tt and it seemed to work.
|
Yes, If I remove that lines it's working in Visual Studio 2022 but no in VS 2019. |
Interesting... not sure what did the trick for me but everything works fine. Recently, I have installed ".NET desktop development" feature, maybe this one helped? |
Installing this .Net desktop feature (check the c# templates box) along with this stackoverflow post worked for me:
|
After another VS2022 update I got the issue back and simple replacement "GetService(typeof(DTE))" -> "GetCOMService(typeof(DTE))" worked for me. |
With VS2022 v.17.2.4 and T4MVC 4.0.0, I got this error:
Tried the solutions mentioned here, updated VS to 17.2.6, and T4MVC to 4.2.4, but still the same exception. Any new ideas? |
We are also observing similar problems. Will update if we get anything to work. |
The other solution mentioned in that issue appears to work for me.
|
I am having the same problem with version 17.3.5. |
I removed following lines from T4MVC.tt and it works in vs2022.
Thanks @adamjford And @cblaze22 |
Sorry, If I remove that lines is not working in VS2019 |
So this comes down to edit the .tt to either work in VS2019 or work in VS2022. I would love to hear if there is another way to conditionally include imports based on VS version. |
I got this error even with Visual Studio 17.7 preview3.0 for |
In order to figure out how many assemblies are added behind scene I wrote this piece of code in TextTemplate file (aka TT)
and I got System which when I checked (Microsoft.VisualStudio.Interop). it contains a EnvDTE.DTE type causes conflict with
code |
In Visual Studio 2022 there are many conflicts with classes defined in Microsoft.VisualStudio.Interop
Just a few of them:
Error Compiling transformation: The type 'CodeTypeRef' 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'
Error Compiling transformation: The type 'CodeClass2' exists in both 'EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Error Compiling transformation: The type 'SVsQueryEditQuerySave' exists in both 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
The text was updated successfully, but these errors were encountered: