【问题标题】:service stack using OrmLiteOrmLite and t4 to create poco使用 OrmLiteOrmLite 和 t4 创建 poco 的服务堆栈
【发布时间】:2013-10-25 19:39:22
【问题描述】:

所以使用给定的 t4 文件https://github.com/ServiceStack/ServiceStack.OrmLite/tree/master/src/T4

我无法让它工作,我收到这个错误:我看到这是一个问题,它调用 32 位版本但我使用 64 位版本我搜索并尝试了可能的解决方案,但对我来说没有工作可能的解决方案是(PlatformTarget AnyCPU)但仍然无法正常工作。有什么想法吗?

错误 1 ​​程序集加载问题发生以下异常:'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' : System.BadImageFormatException: No se puede cargar el archivo o ensamblado 'file:///C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' ni una de sus dependencias。 Se ha intentado cargar un programa con un formato wrongo。 档案名称:'file:///C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll' en System.Reflection.RuntimeAssembly._nLoad(AssemblyName 文件名,字符串代码库,证据 assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark 和 stackMark,IntPtr pPrivHostBinder,布尔 throwOnFileNotFound,布尔 forIntrospection,布尔suppressSecurityChecks) en System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据 assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark 和 stackMark,IntPtr pPrivHostBinder,布尔 throwOnFileNotFound,布尔 forIntrospection,布尔suppressSecurityChecks) en System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据 assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark 和 stackMark,布尔 throwOnFileNotFound,布尔 forIntrospection,布尔suppressSecurityChecks) en System.Reflection.RuntimeAssembly.InternalLoadFrom(字符串 assemblyFile,证据 securityEvidence,Byte[] hashValue,AssemblyHashAlgorithm hashAlgorithm,Boolean for Introspection,Boolean suppressSecurityChecks,StackCrawlMark 和 stackMark) zh System.Reflection.Assembly.LoadFrom(String assemblyFile) zh Microsoft.VisualStudio.TextTemplating.TransformationRunner.AttemptAssemblyLoad(String assemblyName)

警告:程序集绑定日志记录已禁用。 要启用记录程序集绑定失败,请设置注册表值 [HKLM\Software\Microsoft\Fusion! EnableLog ] (DWORD ) 为 1。 注意:有一些与错误日志程序集绑定相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!启用日志]。

在 Windows 8 中使用 vs2012

【问题讨论】:

  • OrmLite T4 模板在 VS2012 / Windows 8 上对我来说可以正常工作。您能否提供一些有关您的设置的更多信息 - 您的连接字符串是什么?

标签: servicestack t4 ormlite-servicestack


【解决方案1】:

块引用

以下是我的步骤:

  • 在 Visual Studio 2013 中创建新的控制台应用

  • 在 App.config 中添加“ConnectionString”

  • 在 Nuget 控制台中:Install-Package ServiceStack.OrmLite.SqlServer

  • 在 Nuget 控制台中:Install-Package ServiceStack.OrmLite.T4(忽略错误)

  • 为所有 .tt 文件删除文件顶部和底部的空白行 OrmLite.Core.ttinclude OrmLite.Poco.tt OrmLite.SP.tt

  • 编译您的项目。

块引用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-12
    • 1970-01-01
    • 2022-01-22
    • 2016-09-28
    • 1970-01-01
    • 2017-11-13
    相关资源
    最近更新 更多