无法生成 NHibernate.Moles.dll - 生成的代码中出现构建错误
我正在尝试使用可执行文件为 NHibernate.dll 生成 moles 程序集下载附带,但生成的代码带有一些构建错误,我不知道如何修复(如果可能的话)。
这就是我所做的:
- 将 NHibernate.dll 和 Iesi.Collections.dll 复制到新目录。
- 站在该目录中,运行
../pathtomoles/moles.exe NHibernate.dll
Moles 然后输出以下内容:
Microsoft Moles v0.94.51023.0 - http://research.microsoft.com/moles - .NET v4.0. 30319 Copyright (c) Microsoft Corporation 2007-2010. All rights reserved. 00:00:00.00> moles Moles : info : metadata : loading D:\ ... \NHibernate.dll Moles : info : compilation : output assembly name: NHibernate.Moles Moles : info : code : found 2018 types Moles : info : code : visibility: exported or assembly(NHibernate.Moles) 00:00:01.87> code generation Moles : info : code : generating code at D:\ ... \obj\moles\nh\m.g.cs 00:00:02.05> stubs generation Moles : info : code : generated 1361 stub types 00:00:05.68> moles generation Moles : info : code : generated 1552 mole types 00:00:24.13> compiling
构建失败并出现以下错误:
error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level error CS0703: Inconsistent accessibility: constraint type 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor'
我已打开项目以查看是否可以我自己修复了错误,但事实证明 Moles 在一个代码文件中生成了所有内容,该文件非常庞大(构建错误发生在第 333100 行和第 333102 行...),因此 Visual Studio 或多或少会崩溃 打开。
有没有办法修复这个生成错误?我查看了moles.exe 的选项,但我不太了解。
还有其他人已经生成了 NHibernate.Moles.dll 吗?如果是这样,我在哪里可以找到它?由于 .
在谷歌搜索中表示“任何单词分隔符”,因此它没有给我太多...
完整的构建输出,以供参考:
--- Output Build started 2011-07-05 10:19:03. Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies \NHibernate Moles\obj\moles\nh\m.g.csproj" on node 1 (default targets). PrepareForBuild: Creating directory "b\". Creating directory "o\". GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fil es are up-to-date with respect to the input files. CoreCompile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /unsafe+ /no warn:1587,1591,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /doc:b\NHibernat e.Moles.xml /define:TRACE /reference:ic="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\ Microsoft Moles\PublicAssemblies\NHibernate Moles\Iesi.Collections.dll" /referen ce:"C:\Program Files (x86)\Common Files\Microsoft Shared\ExtendedReflection\0.94 .51023.0\bin\Microsoft.ExtendedReflection.dll" /reference:mmf="C:\Program Files (x86)\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll" /reference :"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ v4.0\mscorlib.dll" /reference:nh="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microso ft Moles\PublicAssemblies\NHibernate Moles\NHibernate.dll" /reference:"C:\Progra m Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System .Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra mework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Re ference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference :ssm="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew ork\v4.0\System.ServiceModel.dll" /reference:st="C:\Program Files (x86)\Referenc e Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Transactions.dll" /re ference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFra mework\v4.0\System.Xml.dll" /debug:pdbonly /keyfile:m.g.snk /optimize+ /out:o\NH ibernate.Moles.dll /target:library m.g.cs "C:\Users\Tomas\AppData\Local\Temp\.NE TFramework,Version=v4.0.AssemblyAttributes.cs" m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\Ve ndor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type 'Re motion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate .Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D:\P rojects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate M oles\obj\moles\nh\m.g.csproj] Done Building Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\Pu blicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj" (default targets) -- FA ILED. Build FAILED. "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibern ate Moles\obj\moles\nh\m.g.csproj" (default target) (1) -> (CoreCompile target) -> m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBas e' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\ Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj ] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type ' Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHiberna te.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D: \Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] 0 Warning(s) 2 Error(s) Time Elapsed 00:00:03.24 --- Environment Moles : warning : compilation : project compilation failed with exit code 1 Moles : warning : compilation : compilation failed, retrying without Code Co ntracts --- Output Build started 2011-07-05 10:19:06. Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies \NHibernate Moles\obj\moles\nh\m.g.csproj" on node 1 (default targets). GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fil es are up-to-date with respect to the input files. CoreCompile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /unsafe+ /no warn:1587,1591,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /doc:b\NHibernat e.Moles.xml /define:TRACE /reference:ic="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\ Microsoft Moles\PublicAssemblies\NHibernate Moles\Iesi.Collections.dll" /referen ce:"C:\Program Files (x86)\Common Files\Microsoft Shared\ExtendedReflection\0.94 .51023.0\bin\Microsoft.ExtendedReflection.dll" /reference:mmf="C:\Program Files (x86)\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll" /reference :"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ v4.0\mscorlib.dll" /reference:nh="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microso ft Moles\PublicAssemblies\NHibernate Moles\NHibernate.dll" /reference:"C:\Progra m Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System .Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra mework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Re ference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference :ssm="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew ork\v4.0\System.ServiceModel.dll" /reference:st="C:\Program Files (x86)\Referenc e Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Transactions.dll" /re ference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFra mework\v4.0\System.Xml.dll" /debug:pdbonly /keyfile:m.g.snk /optimize+ /out:o\NH ibernate.Moles.dll /target:library m.g.cs "C:\Users\Tomas\AppData\Local\Temp\.NE TFramework,Version=v4.0.AssemblyAttributes.cs" m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\Ve ndor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type 'Re motion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate .Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D:\P rojects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate M oles\obj\moles\nh\m.g.csproj] Done Building Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\Pu blicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj" (default targets) -- FA ILED. Build FAILED. "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibern ate Moles\obj\moles\nh\m.g.csproj" (default target) (1) -> (CoreCompile target) -> m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBas e' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\ Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj ] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type ' Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHiberna te.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D: \Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] 0 Warning(s) 2 Error(s) Time Elapsed 00:00:02.76
I'm trying to generate a moles assembly for NHibernate.dll using the executable that comes with the download, but the generated code comes with some build errors that I don't know how to fix (if it's even possible).
This is what I do:
- Copy NHibernate.dll and Iesi.Collections.dll to a fresh directory.
- Standing in that directory, run
../pathtomoles/moles.exe NHibernate.dll
Moles then outputs the following:
Microsoft Moles v0.94.51023.0 - http://research.microsoft.com/moles - .NET v4.0. 30319 Copyright (c) Microsoft Corporation 2007-2010. All rights reserved. 00:00:00.00> moles Moles : info : metadata : loading D:\ ... \NHibernate.dll Moles : info : compilation : output assembly name: NHibernate.Moles Moles : info : code : found 2018 types Moles : info : code : visibility: exported or assembly(NHibernate.Moles) 00:00:01.87> code generation Moles : info : code : generating code at D:\ ... \obj\moles\nh\m.g.cs 00:00:02.05> stubs generation Moles : info : code : generated 1361 stub types 00:00:05.68> moles generation Moles : info : code : generated 1552 mole types 00:00:24.13> compiling
and the build fails with the following errors:
error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level error CS0703: Inconsistent accessibility: constraint type 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor'
I've opened the project to see if I could fix the error myself, but it turns out Moles generates everything in one single code file, which is thus huge (the build errors occur on lines 333100 and 333102...) so Visual Studio more or less crasches on open.
Is there anyway to fix this generation error? I've looked at the options to moles.exe, but I don't get much of it.
Has anyone else already generated NHibernate.Moles.dll? If so, where do I find it? Since .
means "any word separator" in a google search, it hasn't given me much...
The complete build output, for reference:
--- Output Build started 2011-07-05 10:19:03. Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies \NHibernate Moles\obj\moles\nh\m.g.csproj" on node 1 (default targets). PrepareForBuild: Creating directory "b\". Creating directory "o\". GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fil es are up-to-date with respect to the input files. CoreCompile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /unsafe+ /no warn:1587,1591,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /doc:b\NHibernat e.Moles.xml /define:TRACE /reference:ic="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\ Microsoft Moles\PublicAssemblies\NHibernate Moles\Iesi.Collections.dll" /referen ce:"C:\Program Files (x86)\Common Files\Microsoft Shared\ExtendedReflection\0.94 .51023.0\bin\Microsoft.ExtendedReflection.dll" /reference:mmf="C:\Program Files (x86)\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll" /reference :"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ v4.0\mscorlib.dll" /reference:nh="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microso ft Moles\PublicAssemblies\NHibernate Moles\NHibernate.dll" /reference:"C:\Progra m Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System .Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra mework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Re ference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference :ssm="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew ork\v4.0\System.ServiceModel.dll" /reference:st="C:\Program Files (x86)\Referenc e Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Transactions.dll" /re ference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFra mework\v4.0\System.Xml.dll" /debug:pdbonly /keyfile:m.g.snk /optimize+ /out:o\NH ibernate.Moles.dll /target:library m.g.cs "C:\Users\Tomas\AppData\Local\Temp\.NE TFramework,Version=v4.0.AssemblyAttributes.cs" m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\Ve ndor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type 'Re motion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate .Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D:\P rojects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate M oles\obj\moles\nh\m.g.csproj] Done Building Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\Pu blicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj" (default targets) -- FA ILED. Build FAILED. "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibern ate Moles\obj\moles\nh\m.g.csproj" (default target) (1) -> (CoreCompile target) -> m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBas e' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\ Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj ] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type ' Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHiberna te.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D: \Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] 0 Warning(s) 2 Error(s) Time Elapsed 00:00:03.24 --- Environment Moles : warning : compilation : project compilation failed with exit code 1 Moles : warning : compilation : compilation failed, retrying without Code Co ntracts --- Output Build started 2011-07-05 10:19:06. Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies \NHibernate Moles\obj\moles\nh\m.g.csproj" on node 1 (default targets). GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fil es are up-to-date with respect to the input files. CoreCompile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /unsafe+ /no warn:1587,1591,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /doc:b\NHibernat e.Moles.xml /define:TRACE /reference:ic="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\ Microsoft Moles\PublicAssemblies\NHibernate Moles\Iesi.Collections.dll" /referen ce:"C:\Program Files (x86)\Common Files\Microsoft Shared\ExtendedReflection\0.94 .51023.0\bin\Microsoft.ExtendedReflection.dll" /reference:mmf="C:\Program Files (x86)\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll" /reference :"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ v4.0\mscorlib.dll" /reference:nh="D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microso ft Moles\PublicAssemblies\NHibernate Moles\NHibernate.dll" /reference:"C:\Progra m Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System .Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra mework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Re ference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference :ssm="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew ork\v4.0\System.ServiceModel.dll" /reference:st="C:\Program Files (x86)\Referenc e Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Transactions.dll" /re ference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFra mework\v4.0\System.Xml.dll" /debug:pdbonly /keyfile:m.g.snk /optimize+ /out:o\NH ibernate.Moles.dll /target:library m.g.cs "C:\Users\Tomas\AppData\Local\Temp\.NE TFramework,Version=v4.0.AssemblyAttributes.cs" m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBase' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\Ve ndor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type 'Re motion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHibernate .Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D:\P rojects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate M oles\obj\moles\nh\m.g.csproj] Done Building Project "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\Pu blicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj" (default targets) -- FA ILED. Build FAILED. "D:\Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibern ate Moles\obj\moles\nh\m.g.csproj" (default target) (1) -> (CoreCompile target) -> m.g.cs(333102,50): error CS0122: 'Remotion.Data.Linq.Clauses.ResultOperatorBas e' is inaccessible due to its protection level [D:\Projects\NCVIB-GIT\NCVIB\src\ Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj ] m.g.cs(333100,26): error CS0703: Inconsistent accessibility: constraint type ' Remotion.Data.Linq.Clauses.ResultOperatorBase' is less accessible than 'NHiberna te.Linq.Visitors.ResultOperatorProcessors.Moles.MResultOperatorProcessor' [D: \Projects\NCVIB-GIT\NCVIB\src\Vendor\Microsoft Moles\PublicAssemblies\NHibernate Moles\obj\moles\nh\m.g.csproj] 0 Warning(s) 2 Error(s) Time Elapsed 00:00:02.76
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我生成所有类型,我确实会收到错误,但是您可以在 nhibernate 中对类型进行子选择,有可能生成摩尔。
我的 vs.net 项目中的 NHibernate.moles 文件:
好的,我获得了使用 .moles 文件的参数:
如果您不对这些类型执行任何操作,我不确定是否需要包含 Iesi.Collections。
If I generate all types I do get an error, however you can make a sub selection of the types in nhibernate it is possible to generate moles.
The NHibernate.moles file in my vs.net project:
Ok I got the parameters for using .moles files:
I'm not sure if you need to include the Iesi.Collections if you do not do anything with those types.