简体   繁体   中英

T4MVC throws a serialization error when trying to "Run Custom Tool"

Today, after upgrading Visual Studio to 17.2.3 I get this error when trying to run T4MVC:

Running transformation: System.Runtime.Serialization.SerializationException: Type 'Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase' in Assembly 'Microsoft.VisualStudio.Platform.WindowManagement, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

I have seen others with the same issue, but the solutions suggested there do not solve it for me: VS2022 17.2.0 Preview 2.0: T4 template serialization exception when accessing projects, etc T4 error when running Custom Tool in vs2017

I have tried removing/adding the project, I've tried restarting Windows, I have no idea where to look as this was working without issues previously.

Any suggestions?

EDIT: After debugging more I can see that the inner exception is: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Shell.Interop.IVsQueryEditQuerySave2'

I was finally able to fix the issue.

I ended up uninstalling VS (v. 17.2.3) and reinstalling and then repairing and after that (and applying the fixes already mentioned from this post: VS2022 17.2.0 Preview 2.0: T4 template serialization exception when accessing projects, etc ) I am now able to run the T4MVC tool without errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM