gpt4 book ai didi

entity-framework - .net Entity Framework T4 模板在升级到 VS 2012 后无法构建/工作

转载 作者:行者123 更新时间:2023-12-01 07:16:07 27 4
gpt4 key购买 nike

安装 Vs 2012 后,我尝试先添加实体模型数据库。
T4 模板将无法构建。

当我尝试调试它时,我收到了这些错误。

Error 1 - There was a problem loading the assembly 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' The following Exception was thrown: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'file:///C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at Microsoft.VisualStudio.TextTemplating.TransformationRunner.AttemptAssemblyLoad(String assemblyName)

=== Pre-bind state information === LOG: User = MANNVIT\Ole LOG: Where-ref bind. Location = C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE/ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: This bind starts in LoadFrom load context. WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). LOG: No application configuration file found. LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

Warning 2 Compiling transformation: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll' C:\Users\Ole\documents\visual studio 11\Projects\Cantina\Cantina\Models\navision.Context.tt

Error 3 Compiling transformation: The type or namespace name 'CSharp' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) c:\Users\Ole\AppData\Local\Temp\qiu0vq02.0.cs

Error 4 Compiling transformation: The type or namespace name 'CSharpCodeProvider' could not be found (are you missing a using directive or an assembly reference?) c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude 37 22

Error 5 Compiling transformation: The type or namespace name 'CompilerErrorCollection' does not exist in the namespace 'System.CodeDom.Compiler' (are you missing an assembly reference?) c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude



我相信问题是它试图使用的 32 位和 64 位 dll 的混合。

加载 64 位 mscorlib.dll 和 32 位 system.data.dll。 (但我不确定)

我的构建配置器平台是任何 CPU。

尝试放入 <PlatformTarget>x64</PlatformTarget>在我的 C# 项目文件中,但这没有帮助。

我使用的是 64 位 win 7 pc。我也安装了 vs 2010。

我已经完成了以下操作,安装了 vs 2012 prof。 rtm,已卸载 vs 2012 Ultimate rc。

在此之后,我注意到了错误。

然后我尝试卸载所有 .net 框架和 vs 2012 rtm。并再次 installin vs 2012 rtm,但它仍然给我错误。

有人可以请。帮我解决什么问题。

最佳答案

我错误地将构建配置设置为 x64,并得到了同样的错误。当我把它放到 Any CPU 时,错误就消失了。当我把它放回 x64 时,它仍然可以正常构建。所以我不知道为什么,但是更改构建配置并将其改回来修复了它!

关于entity-framework - .net Entity Framework T4 模板在升级到 VS 2012 后无法构建/工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13376781/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com