VS2008和VS2010的FSharp.Compiler.CodeDom并排 [英] FSharp.Compiler.CodeDom for VS2008 and VS2010 side-by-side

查看:142
本文介绍了VS2008和VS2010的FSharp.Compiler.CodeDom并排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FSharp.Compiler.CodeDom(来自 PowerPack )动态创建F#类.问题是,我的计算机上并排装有VS2008和VS2010(它们工作正常),并且在此配置中使用F#充其量是错误的:

I'm using FSharp.Compiler.CodeDom (from the PowerPack) to dynamically create F# classes. The problem is, that I have both VS2008 and VS2010 on my computer side-by-side (they works fine), and using F# in this configuration is buggy at best:

  • 如果我不安装InstallFSharp.msi,则在VS2008下,内置类抱怨找不到FSharp.Core(即使已引用)
  • 如果我安装InstallFSharp.msi,则在VS2008下,构建的类将使用为VS2010构建的F#,并且将引发二进制不兼容异常,因为它将加载.net4变体:

  • If I don't install InstallFSharp.msi, then under VS2008 the built classes complain about not finding FSharp.Core (even if they're referenced)
  • If I install InstallFSharp.msi, then under VS2008 the built classes will use the F# built for VS2010, and will throw a binary-incompatibility exception, because it will load the .net4 variant:

FSC:错误FS0219:引用或默认的基本CLI库'mscorlib'是二进制文件- 与引用的F#核心库'C:\ Program Files(x86)\ Microsoft不兼容 F#\ v4.0 \ FSharp.Core.dll".考虑重新编译库或进行明确引用 到与您使用的CLI版本匹配的该库版本.

FSC: error FS0219: The referenced or default base CLI library 'mscorlib' is binary- incompatible with the referenced F# core library 'C:\Program Files (x86)\Microsoft F#\v4.0\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.

如果将先前位置的F#替换为单独安装的dll-s,则VS2010当然会抱怨二进制不兼容

If I replace the F# found at the previous location to the separately installed dll-s, then of course VS2010 will complain about binary-incompatibility

我是否正在忽略某些东西,否则它们将不会仅在这样的共享环境中工作?在部署应用程序时,这可能意味着真正的问题.

Am I overlooking something, or they won't simply work for a shared environment like this? This might mean real problems when I deploy the applications.

谢谢

推荐答案

我自己也遇到类似的问题-源树的主干设置为使用VS 2008构建,而我们的最新分支升级到VS2010.F#至少可以这样说,情况令人烦恼.

I have a similar problem myself - the trunk of our source tree is set up to build with VS 2008, while our latest branch upgrades to VS 2010. The F# situation is wearisome, to say the least.

我们找到的答案是使用--noframework编译器标志.设置该选项后,您可以(必须)指定要使用的mscorlib.dll和System.dll,因此可以针对任何受支持的.NET框架进行构建.

The answer that we've found is to use the --noframework compiler flag. With that option set, you can (must) specify which mscorlib.dll and System.dll you want to use, and therefore can build against any supported .NET framework.

这篇关于VS2008和VS2010的FSharp.Compiler.CodeDom并排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆