2

我正在oxyplot使用fsxamlgjallarhorn。它在直接使用它并绑定到 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文件 (x86)\Reference Assemblies\Microsoft\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\用户名\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" -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\用户名\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文件 (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

4

2 回答 2

2

很确定错误在:

Gjallarhorn.Bindable.dll

Gjallarhorn.dll

出于某种原因,您正在引用可移植库。

编辑路径以指向完整的 .net 版本

于 2016-06-13T10:04:14.613 回答
2

确实,PCL 和类型提供程序不能很好地结合在一起。这似乎是由VisualF# Issue 99引起的。解决方法是将 ViewModel 代码移动到单独的库中。

于 2016-06-15T23:50:23.590 回答