Typelite 错误:运行转换:System.Reflection.ReflectionTypeLoadExcepti



我正在使用Typelite 1.8.4从c#类生成我的Typescript类。

当我启动Visual Studio 2017并执行"运行自定义工具"时,TypeLite.Net4.tt 它运行良好,并且正在生成Typescript类。但是当我再次尝试时,它失败并出现此错误:

运行转换:System.Reflection.ReflectionTypeLoadException:无法加载一个或多个请求的类型。检索 LoaderExceptions 属性以获取更多信息。

at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module(

at System.Reflection.RuntimeModule.GetTypes((

at System.Reflection.Assembly.GetTypes((

at TypeLite.TsModelBuilder.Add(Assembly Assembly( in C:\Users\Lukas\Source\Repos\TypeLITEv1\TypeLite\TsModelBuilder.cs:line 134 at TypeLite.Net4.TypeScriptFluentExtensions.ForLoadedAssemblies(TypeScriptFluent ts( in C:\Users\Lukas\Source\Repos\TypeLITEv1\TypeLite.Net4\TypeScriptFluentExtensions.cs:line 15

at Microsoft.VisualStudio.TextTemplating9A6A0626656F4B1B1A666FE3F7627C9E3D094486020135F96EA52B0B12A8F2A3ADF349B4229C4882A5008416F0CCFFB9B9AB22544159413BEC922E10DC8E87A3.Generated TextTransformation.TransformText(( MyAppName C:\VSTS\MySolutionName\MyProjectName\Scripts\TypeLite.Net4.tt 1

关闭Visual Studio并再次打开它后,"运行自定义工具"再次正常工作,并生成Typescript类。但是重新启动Visual Studio后,它每次尝试都会失败,并且TypeLite.Net4.d.ts变为空。

如何让 Typelite 生成的类始终正常工作而不会出错?

我不知道是什么原因造成的,但如果您不想关闭VS/Solution,您可以clean solution,之后rebuild,它将再次工作。

最新更新