mvsmal / fable-material-ui

Fable bindings for Material-UI https://mvsmal.github.io/fable-material-ui/
MIT License
61 stars 8 forks source link

Add a reminder to check reference in project file #38

Closed yan0lovesha closed 5 years ago

yan0lovesha commented 5 years ago

The package reference is not added to project file if yarn is used to add nuget package. Add a reminder to readme file.

mvsmal commented 5 years ago

Yarn/npm can never be used to add nuget package. Fable.MaterialUI is only an F# wrapper for MaterialUI JavaScript library. So with Yarn/npm you install the javascript library and with dotnet/paket you should install Fable.MaterialUI nuget package. I should probably update Readme to make it clearer

yan0lovesha commented 5 years ago

@mvsmal

Yeah, my bad. I actually used "paket add Fable.MaterialUI" to install the nuget package. But the reference is not added to client.fsproj. I spent an hour to find out why "open Fable.Helpers.MaterialUI" doesn't work. Use "dotnet add package Fable.MaterialUI" is fine. This one is required to be executed in a Client folder which contains an fsproj file. It will add the reference to project file. Then in .fs files we can use the names in your package.

I added the reminder under NPM section. I should add it under Nuget section. Do you mind I create another PR to make it clear? Or you will do it by your self?

mvsmal commented 5 years ago

If you use paket you shouldn't have any package references in the .fsproj file. There should be paket.references file enumerating the dependencies. In your case, I suppose, you should have run paket add Fable.MaterialUI --project src/client.fsproj. Refer to https://fsprojects.github.io/Paket/paket-add.html

yan0lovesha commented 5 years ago

That make sense. Thanks for your response. I just executed the paket command without project parameter. So, It just add reference to dependencies file. I still cannot use it in .fs source file until I manually add the reference. Thanks again.

mvsmal commented 5 years ago

After you add the dependency try to run dotnet restore on the client.fsproj or on .sln file if you have it. With Paket you never need package references in .fsproj file.