fsprojects / FsXaml

F# Tools for working with XAML Projects
http://fsprojects.github.io/FsXaml/
MIT License
171 stars 48 forks source link

FSC: error FS2024: Static linking may not use assembly that targets different profile #42

Closed s952163 closed 8 years ago

s952163 commented 8 years ago

Description

Build error: FSC: error FS2024: Static linking may not use assembly that targets different profile with OxyPlot example and FsXaml when using VS2015 Update 2. .NET 4.6.x. I attached the VS project. SimpleDemoFsharp (2).zip

Repro steps

Program.fs:

open System
open System.Windows
open FsXaml

// Comment out to build:
type MainWin = XAML<"MainWindow.xaml">

[<STAThread>]
[<EntryPoint>]
let main argv = 
    // Comment out to build:
    let app = Application()
    let win = MainWin()
    app.Run win    

MainViewModel.fs:

namespace SimpleDemoFsharp

open OxyPlot
open OxyPlot.Series

type MainViewModel() =
    let myModel = PlotModel()
    //comment below to build an empty window with FSXAML:
    do
        myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)"))
    member mainWindow.MyModel with get() = myModel

XAML:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"
    xmlns:local="clr-namespace:SimpleDemoFsharp;assembly=SimpleDemoFsharp"

    Title="OxyPlot in F# and WPF" Height="480" Width="640">
    <Window.DataContext>
        <local:MainViewModel/>
    </Window.DataContext>
    <Grid>
        <oxy:PlotView Model="{Binding MyModel}"/>
    </Grid>
</Window>

Expected behavior

Show oxyplot plotmodel when using FSXAML.

Actual behavior

When loading the XAML directly, oxyplot creates the chart. When loading the XAML via FSXAML, the project won't build. When uncommenting the myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)")) line the project compiles.

ReedCopsey commented 8 years ago

Unfortunately, this is due to https://github.com/Microsoft/visualfsharp/issues/99

I'm not sure there's a possible workaround until that is corrected. Going to close for now.