-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create Fable plugin #3625
Comments
Hello, When consuming a plugin in local development you need to tell Fable to exclude it from the compilation. For example, Does doing so solve your problem? |
I did try that earlier (ie.
|
You may need to have My full command was: |
Nah, that might not be it. Do you have // Tell Fable to scan for plugins in this assembly
[<assembly : ScanForPlugins>]
do () in your plugin assembly as well? |
That unfortunately doesn't seem to change anything. Also tried using the I've uploaded a minimal repro here: https://github.com/OrfeasZ/fable-plugin-repro The command I'm using is: dotnet fable ./FablePluginTest/FablePluginTest.fsproj -o out --exclude FablePluginTest.Plugin Maybe it has to do with how the plugin project is referenced from the main project? |
So I was able to debug the problem. If you look at the console output, you should see an error about Fable not being able to compile the Project because of
This is coming from: Fable/src/Fable.Cli/ProjectCracker.fs Lines 495 to 523 in 308acef
But the actual error exception is occurring from here: Fable/src/Fable.Cli/ProjectCracker.fs Lines 123 to 143 in 308acef
The problem is that for some reason, So when Fable tries to Changing
I am not sure if this is because of a bug in the plugin implementation or in Fable code itself. I believe the problem is related the .NET SDK used when running Fable. Indeed, forcing the repository to use .NET 6, then everything is working correctly. Luckily, the problem seems to only occurs when working with local plugin, so projects in production that use Feliz (for example) and .NET still works. @OrfeasZ If you want to work on your plugin, you can force you repository to use .NET 6 via a {
"sdk": {
"version": "6.0.100",
"rollForward": "latestFeature"
}
} |
@MangelMaxime good catch, thanks a lot! Didn't even notice this error... 😅 Changing the plugin project to target .NET 6 does indeed fix this issue! |
I can also confirm that |
Only Fable/src/Fable.Cli/Fable.Cli.fsproj Line 6 in 308acef
|
@MangelMaxime where in https://github.com/fable-compiler/fable-compiler.github.io/tree/dev/docs/docs would be a good place to write some docs on what we learned in this thread? |
Currently, we have "Author a Fable library" in the "Your Fable project" section. So we could add a page "Author a Fable plugin" / "Create a Fable plugin" below that page. The other solution would be to create a section dedicated to Fable plugins, but creating a section for a single page seems a little wasteful to me. My feeling currently is that "Your Fable project" name is not the correct name for that section, as "Author a Fable plugin" kind of feel out of place already in that section. |
That's exactly what I did! In regards to docs, I'm happy to contribute some parts after I've played with the plugin capabilities a bit. |
I'm trying to create a Fable plugin but I'm having some trouble.
As a very basic starting point, I tried creating the following attribute:
However, when trying to compile my project with Fable, I get the following error:
My project file looks like this:
This is included from another F# project, and compiled using the following command (fable version is
4.5.0
):What am I doing wrong?
The text was updated successfully, but these errors were encountered: