English 中文(简体)
F# Power Pack setadata don tgniFSharp。 核心作为F#图书馆
原标题:F# Powerpack s Metadata doesn t recognize FSharp.Core as an F# library

这里,我的标准是孤立问题:

open Microsoft.FSharp.Metadata
[<EntryPoint>]
let main args =
  let core = FSharpAssembly.FromFile @"C:Program FilesFSharp-2.0.0.0\binFSharp.Core.dll"
  let core2 = FSharpAssembly.FSharpLibrary
  let core3 = System.AppDomain.CurrentDomain.GetAssemblies() 
              |> Seq.find (fun a -> a.FullName.Contains "Core") 
              |> FSharpAssembly.FromAssembly

  core.Entities |> Seq.iter (printfn "%A")
  0

所有三个<条码>都应给我同样的FSharpAssembly。 相反,所有3个国家都提出了Sharp的例外。 核心不是“F#”组(细节如下,改为可读)。 另有两点:

  1. Using the core3 method, I get the same error for the test F# assembly itself
  2. I don t get the error at FSI after doing #r "@C:Program Files...FSharp.Powerpack.Metadata.dll".

任何想法? I m利用视觉演播室2008年,F# 2.0和F# Power Pack 2.0.0.0(2010年5月20日)发布在一部古老的XP RV上,我认为它已经更新到SP3。

(我今天上午用Power Pack 1.9.9错,因此我升至2.0.0.0。) 我认为,如果1.9.9.9.不承认F# s2.0.0.0s的组件,那么,在电容器2.0.0.0中也许可以装饰。

Unhandled Exception: System.TypeInitializationException: 
  The type initializer for  Microsoft.FSharp.Metadata.AssemblyLoader  threw an
    exception. 
  ---> System.TypeInitializationException: The type initializer for
     <StartupCode$FSharp-PowerPack-Metadata>.$Metadata  threw an exception. 
  ---> System.ArgumentException: could not produce an FSharpAssembly 
    object for the assembly  FSharp.Core  because 
    this is not an F# assembly
Parameter name: name
   at Microsoft.FSharp.Metadata.AssemblyLoader.Add(String name,Assembly assembly)
   at <StartupCode$FSharp-PowerPack-Metadata>.$Metadata..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.FSharp.Metadata.AssemblyLoader..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.FSharp.Metadata.AssemblyLoader.Get(Assembly assembly)
   at Microsoft.FSharp.Metadata.FSharpAssembly.FromAssembly(Assembly assembly)
   at Program.main(String[] args) in 
     C:Documents an...FSMetadataTestProgram.fs:line 11
Press any key to continue . . .
最佳回答

Nathan, great investigation, the version number was indeed not updated in original May2010 release, see http://fsharppowerpack.codeplex.com/workitem/4548 We have uploaded binaries with corrected version number.

问题回答

我通过阅读。 电力包。 元数据总是装载FSharp。 在任何其他集会之前,如果会议破裂,会把其余部分隔开。

从我的研究来看,大多数是其他研究。 F#组件在“FSharpSignatureData.Package.Name的明显资源流中携带其元数据。 但FSharp。 页: 1 (至少,在我的XP RV上,2008年VS下载2.0.0,没有。) 因此,电力包元数据看着一个叫做FSharp的档案。 同一份目录中的核心数据,预计会找到FSharp。 核心费用。

该法典有4个地方,名称如下:

  1. ConfigurationSettings.AppSettings.["fsharp-core-referenceassembly-location"].
  2. The registry key @"SOFTWAREMicrosoft.NETFramework" + MSCorLibRunningRuntimeVersion + @"AssemblyFoldersExMicrosoft Visual F# 4.0", where MSCorLibRunningRuntimeVersion is determined by reflection--in my case it s "v2.0.50727". I think this only applies if you have VS 2010 and hence F# 4.0
  3. The registry key @"SoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.FSharp-" + FSharpTeamVersionNumber, where FSharpTeamVersionNumber is hard-coded as "1.9.9.9", at least in the codeplex version. I don t have the source for the May 2010 release installed on my machine.
  4. System.AppDomain.CurrentDomain.BaseDirectory. This is the "bin/Debug" directory of your local project, unless you are in fsi. Then it s some variant of C:Program FilesFSharp-2.0.0.0in.

对我来说,这四人都失败了:

  1. I don t have an app config file. I don t know the .NET ecosystem very well, so I don t know how to create one.
  2. I don t have VS 2010 installed.
  3. I have a "Microsoft.FSharp-2.0.0.0" key in the right place, but no "Microsoft.FSharp-1.9.9.9" key.
  4. My local project doesn t have a copy of FSharp.Core.sigdata in the bin/Debug directory.

现在我知道什么时候了,我有一些固定装置(除了使用真正的视窗机器,而不是我计划在一个月左右固定的古老的测验仪)。 请见 。 该网络在某个时候将档案整理成册,因此很可能是最好的中期解决办法。 建立登记册的关键“Microsoft”。 缩略语

我仍然不知道这一ug是否应当广泛,或者是否只是由于我从2005-2008年VS升级和多次F#审查而刚刚造成的。 从阅读密码来源来看,在我看来,没有VS 2010的其他人也应当有这一问题,因为FSharpTeamVersionNumber被硬编码为1.9.9,并且已经更新了吨数,以与登记处钥匙2.0.0.0相匹配。 但是,也许我升级到F# 2.0和F# Power Pack 2.0的次序不正确,无法形成这一条件。 或者,可能有足够的人利用元数据图书馆揭露这些丑恶。

这确实令人困惑——我尝试使用你描述的准确情景(F#2.0,2008年视觉演播室,最新PowerPack 2.0,《行为守则》)来管理该守则,并且毫无例外地运作。

你还可以确保,最近释放了2008年视觉演播室的F#(在2010年视觉演播室最后版本之后很快发布),因为FSharp.Core.dll,你重装需要与<代码>兼容。 FSharp. PowerPack.Metadata.dll 。 另外,<代码>Metadata的图书馆能否装上其他<代码>dll的图书馆,这些图书馆的目前版本是F#汇编器?

EDIT If this doesn t work then (I d think) the Metadata library is probably out of sync with the F# compiler:

let a = System.Reflection.Assembly.GetExecutingAssembly()
     |> FSharpAssembly.FromAssembly
printf "%A" a.Entities.Count

如果这样做的话,就会有的意思混淆<>m>——不管什么版本,图书馆应当能够阅读!

let a = FSharpAssembly.FromFile @"C:...inFSharp.PowerPack.Metadata.dll"
printf "%A" a.Entities.Count




相关问题
F#: Storing and mapping a list of functions

I have a number of events that happen in a game. I want to control the time and order at which these events occur. For example: Event 1: Show some text on screen for N frames & play a sound ...

Creating Silverlight 3 applications with F#

Is there an easy way to create Silverlight 3 applications with F# (October CTP)? I have seen the F# for Silverlight, but that only works with the May CTP. I am using Visual Studio Integrated Shell ...

How To Change List of Chars To String?

In F# I want to transform a list of chars into a string. Consider the following code: let lChars = [ a ; b ; c ] If I simply do lChars.ToString, I get "[ a ; b ; c ]". I m trying to get "abc". I ...

Unzipping ZLIB compressed portions of a binary file

I m reading a file(a flash swf) from .Net 3.5 that has a header which states whether the body of the file/Stream is compressed or not. However, I m having problems-after I rewrap the basic File ...

Pretty print a tree

Let s say I have a binary tree data structure defined as follows type a tree = | Node of a tree * a * a tree | Nil I have an instance of a tree as follows: let x = Node (Node (...

F# String Pattern-Matching with Wildcards

As part of a project I have assigned myself as a way of improving my knowledge of F# and functional programming in general, I am attempting to write a string pattern-matching algorithm from scratch ...

热门标签