Compiling transformation: The type 'Object' is defined in an assembly that is not referenced

Issue #113 resolved
Antonio Pretto
created an issue

[I'm copypasting the question I made on StackOverflow,]

I'm making some changes in an asp.Net MVC5 webapp, in which I used typelite to create .ts definitions from C# classes (really handy). For some reason now I've got this error when executing the T4:

"Compiling transformation: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'."

and this warning:

"Compiling transformation: Assuming assembly reference 'mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' used by 'EnvDTE' matches identity 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' of 'mscorlib', you may need to supply runtime policy Mair.Tracking.Web"

I guess it's something related to the EnvDTE version used by TypeLite and the reference to mscorlib EnvDTE uses. Should I add a bindingRedirect in the web.config?

I'm using VS2015 with Update2 CTP.

Comments (7)

  1. Richard Lawley

    I've also got stuck on this bug. I tried the suggestion in the Stack Overflow post of recompiling TypeLite as a non-PCL library and that's working for me as a workaround.

  2. Lukas Kabrt repo owner

    I can confirm that Portable class libraries in combination with T4 templates cause this problem in Visual Studio 2015 Update 2. I wasn't able to find better solution then retargeting TypeLITE to full. NET framework.

    From the version 1.8.0 TypeLITE nuget package contains a copy of the library that targets full .NET framework. If your project targets full .NET framework, the correct TypeLITE assembly is picked up during installation and everything works fine in Visual Studio 2015 Update 2. Unfortunately if your project targets PCL, you are out of luck with Visual Studio 2015 Update 2. I am looking for better solution.

  3. Richard Lawley

    While the 1.8 package in nuget works, it's no longer possible to run the transformations in the demo project within the solution after doing a clean clone from your repo. I suspect you may need to remove some dependencies between the portable and non-portable bits.

  4. Log in to comment