1

I am having problems using the T4 tool in Visual Studio 2012. My .tt-files have an assembly directive to a 64-bit .DLL built in the same solution. This is the output from debugging the tt file:

Error 308 The host threw an exception while trying to resolve the assembly reference '$(TargetDir)\DCSGenerator.dll'. The transformation will not be run. The following Exception was thrown: System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent) at System.Reflection.AssemblyName..ctor(String assemblyName) at Microsoft.VisualStudio.TextTemplating.GlobalAssemblyCacheHelper.GetLocation(String strongName) at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolveAssemblyReference(String assemblyReference) at Microsoft.VisualStudio.TextTemplating.Engine.ResolveAssemblyReferences(ITextTemplatingEngineHost host, TemplateProcessingSession session) C:\TFS\Dev01\CorePlatform\CoreServices\ImportExport.NET\ImportExport.NET\DicomInterface\TemplateUtilFunctions.tt 0 0 ImportExport.NET (CoreServices\ImportExport.NET\ImportExport.NET)

Is anyone else having problems with this?

Best Regards,

UPDATE 2012-11-14 09:17 (CET): Visual Studio and hence the T4 generator runs as a 32-bit application and my assemblies are built as 64bit DLLs. This might be a source of the problem.

UPDATE 2012-11-14 09:43 (CET): Tried to reference the assembly using the full path but this didn't solve the problem.

4

1 回答 1

0

正如我所怀疑的,通过使用PlatformTarget AnyCPU. 现在生成的 DLL 与 32 位和 64 位程序集兼容。

于 2012-11-14T16:00:00.190 回答