我在oxyplot
和fsxaml
使用gjallarhorn
。它直接使用它并绑定到DataPoint(x,y)的输出时工作。但是,当我从SimpleDemoFsharp尝试以下示例时:
type MainViewModel() =
let myModel = PlotModel()
do
myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)"))
member mainWindow.MyModel with get() = myModel
构建失败并显示FSC: error FS2024: Static linking may not use assembly that targets different profile.
错误似乎是由此行引起的:myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)"))
,如果我取消注释项目编译。我尝试过针对较低的.NET版本,并创建新项目,但没有取得多大成功。有解决方法吗?从搜索看来,这可能会导致一些PCL配置文件问题。
这个例子自己编译和工作(即没有安装其他nuget包只有oxyplot和oxyplot.wpf)。
编辑:经过进一步测试后,问题似乎来自FsXaml和Oxyplot的组合。例如,尝试通过FsXaml加载MainWindow.xaml时。
来自VS2015的fsc.exe命令如下:
C:\ Program Files(x86)\ Microsoft SDKs \ F#\ 4.0 \ Framework \ v4.0 \ fsc.exe -o:obj \ x64 \ Debug \ Gjallarhorn160611.exe -g --debug:full --noframework --define:DEBUG --define:TRACE --doc:bin \ Debug \ Gjallarhorn160611.XML --optimize- --platform :x64 --resource:obj \ x64 \ Debug \ Gjallarhorn160611.g.resources -r:" C:\ Program Files(x86)\ Reference 大会\微软\ FSharp.NETFramework \ V4.0 \ 4.4.0.0 \ FSharp.Core.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ FsXaml.Wpf.2.1.0 \ lib \ net45 \ FsXaml.Wpf.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ FsXaml.Wpf.2.1.0 \ lib \ net45 \ FsXaml.Wpf.TypeProvider.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ Gjallarhorn.Bindable.0.0.3-beta1 \ lib \ portable-net45 + netcore45 + wpa81 + wp8 + MonoAndroid1 + MonoTouch1 \ Gjallarhorn.Bindable.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ Gjallarhorn.Bindable.Wpf.0.0.3-beta1 \ lib \ net45 \ Gjallarhorn.Bindable.Wpf.dll&# 34; -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ Gjallarhorn.0.0.3-beta1 \ lib \ portable-net45 + netcore45 + wpa81 + wp8 + MonoAndroid1 + MonoTouch1 \ Gjallarhorn.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ mscorlib.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ OxyPlot.Core.1.0.0-unstable2100 \ lib \ net45 \ OxyPlot.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ OxyPlot.Wpf.1.0.0-unstable2100 \ lib \ net45 \ OxyPlot.Wpf.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ OxyPlot.Wpf.1.0.0-unstable2100 \ lib \ net45 \ OxyPlot.Xps.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ PresentationCore.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ PresentationFramework.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ System.Core.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ System.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ System.Numerics.dll" -r:" C:\ Users \ username \ Documents \ Visual Studio 2015 \ Projects \ Gjallarhorn160611_A \ packages \ Expression.Blend.Sdk.1.0.2 \ lib \ net45 \ System.Windows.Interactivity.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ System.Xaml.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ System.Xml.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ UIAutomationTypes.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ WindowsBase.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Collections.Concurrent.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Collections.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ComponentModel.Annotations.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ComponentModel.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ComponentModel.EventBasedAsync.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Diagnostics.Contracts.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Diagnostics.Debug.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Diagnostics.Tools.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Diagnostics.Tracing.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Dynamic.Runtime.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Globalization.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.IO.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Linq.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Linq.Expressions.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Linq.Parallel.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Linq.Queryable.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Net.NetworkInformation.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Net.Primitives.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Net.Requests.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ObjectModel.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.Emit.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.Emit.ILGeneration.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.Emit.Lightweight.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.Extensions.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Reflection.Primitives.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Resources.ResourceManager.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.Extensions.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.InteropServices.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.InteropServices.WindowsRuntime.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.Numerics.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.Serialization.Json.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.Serialization.Primitives.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Runtime.Serialization.Xml.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Security.Principal.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ServiceModel.Duplex.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ServiceModel.Http.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ServiceModel.NetTcp.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ServiceModel.Primitives.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.ServiceModel.Security.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Text.Encoding.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Text.Encoding.Extensions.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Text.RegularExpressions.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Threading.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Threading.Tasks.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Threading.Tasks.Parallel.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Xml.ReaderWriter.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Xml.XDocument.dll" -r:" C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5 \ Facades \ System.Xml.XmlSerializer.dll" --target:exe --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors --subsystemversion:6.00 --highentropyva + --sqmsessionguid:9587e2f2-adad-4417- 931b-00c055df82f8" C:\ Users \ username \ AppData \ Local \ Temp.NETFramework,Version = v4.5.AssemblyAttributes.fs" AssemblyInfo.fs Model.fs Context3.fs Program.fs
答案 0 :(得分:2)
非常确定错误在:
Gjallarhorn.Bindable.dll
和
Gjallarhorn.dll
出于某种原因,您正在引用便携式库。
编辑路径以指向完整的.net版本
答案 1 :(得分:2)
事实上,PCL和类型提供商并不能很好地协同工作。这似乎是由VisualF# Issue 99引起的。解决方法是将ViewModel代码移动到单独的库中。