fsprojects / FsXaml

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

Is there a tutorial? #83

Open dredgy opened 3 years ago

dredgy commented 3 years ago

Trying to get FsXAML up and running on VS 2017 and I'm thinking of just going back to programmatically designing Windows Forms. Is there an actual official tutorial to get this working? Is the project even still supported?

I followed a tutorial on CSharp corner (https://www.c-sharpcorner.com/article/create-wpf-application-with-f-sharp-and-fsxaml/) and it seemed easy but the damn project wouldn't build (with an "Unknown Error"). So hard to narrow that down.

I'm now trying to build the WpfSimpleDrawingApp. I was unable to get any of the other demo files to build. With the WpfSimpleDrawingApp I'm at least able to install all the dependencies, but on build I get an error.

C:\Users\dredgy\source\.paket\paket.targets(65,5): error MSB3073: The command ""C:\Users\dredgy\source\.paket\paket.exe" restore --references-file "C:\Users\dredgy\source\repos\WpfSimpleDrawingApplication\paket.references"" exited with code 9009.

I have no paket.exe in that folder (I do have paket.bootstrapper.exe there, but it failed when I used that too).

I didn't have paket installed, but tried to through NuGet, only to get an error there too "Package 'Paket 5.249.2' has a package type 'DotnetTool' that is not supported by project 'WpfSimpleDrawingApplication'."

If the project is still supported, I'd love a step by step tutorial or a demo solution that builds.

Appreciate your time, and in theory I love what FsXAML does, I'm shocked that MS doesn't support F# GUI in Visual Studio at all.

FoggyFinder commented 3 years ago

I followed a tutorial on CSharp corner (https://www.c-sharpcorner.com/article/create-wpf-application-with-f-sharp-and-fsxaml/) and it seemed easy but the damn project wouldn't build (with an "Unknown Error").

If you attach the project to the issue (or create repo) I'll try to check it

I'm now trying to build the WpfSimpleDrawingApp. I was unable to get any of the other demo files to build. With the WpfSimpleDrawingApp I'm at least able to install all the dependencies, but on build I get an error.

Have you run build.cmd? After that you have to build all referenced projects (FsXaml.Wpf, FsXaml.Wpf.Blend,FsXaml.Wpf.TypeProvider)

Anyway you can use plain NuGet system instead of Paket

dredgy commented 3 years ago

Appreciate it. I did not run build.cmd, though I have it there. These are things that'd be great in a tutorial, I haven't programmed in a long time!

I redid the tutorial project from C# corner, the sln is available here, greatly appreciate you checking it out: https://www.dropbox.com/s/fzp4crfrfdfkab3/FsUI%20Attempt.zip?dl=0

The exact error: MC1000 Unknown build error, 'Object reference not set to an instance of an object.'

In the file: FsUI Attempt C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets

FoggyFinder commented 3 years ago

I redid the tutorial project from C# corner, the sln is available here, greatly appreciate you checking it out:

OK. The issue is clear. In fsproj file replace

    <Page Include="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>

to

    <Resource Include="MainWindow.xaml" />
    <Resource Include="App.xaml"  />
dredgy commented 3 years ago

Well that definitely works, I’m not sure how clear that was though! Thanks a lot, should be a good foundation to build off.

Have a great one!