fly launch does not recognize an F# project
Please only report specific issues with flyctl behavior. Anything like a support request for your application should go to https://community.fly.io. More people watch that space and can help you faster!
Describe the bug
F# web applications are not recognized as a .NET project even though they use the same tooling and build system as a C# application.
I followed the instructions given here https://fly.io/docs/languages-and-frameworks/dotnet/ but with the exception of using an F# project (.fsproj) rather than a C# project (.csproj)
- Operating system: Windows 11 26100.2033
fly version: fly.exe v0.3.25 windows/amd64 Commit: 8fb314c9230ba972453b5ebf292214d10f076468 BuildDate: 2024-10-21T16:49:16Z
** Command output: **
PS X:\> dotnet new web -lang F# -o Sample
The template "ASP.NET Core Empty" was created successfully.
Processing post-creation actions...
Restoring X:\Sample\Sample.fsproj:
Determining projects to restore...
Restored X:\Sample\Sample.fsproj (in 1.23 sec).
Restore succeeded.
PS X:\> cd Sample
PS X:\sample> dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5214
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: X:\sample
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
PS X:\sample> fly launch
Scanning source code
Could not find a Dockerfile, nor detect a runtime or framework from source code. Continuing with a blank app.
Warning: This organization has no payment method, turning off high availability
Creating app in X:\sample
We're about to launch your app on Fly.io. Here's what you're getting:
Organization: ************** (fly launch defaults to the personal org)
Name: ************* (generated)
Region: Stockholm, Sweden (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres: <none> (not requested)
Redis: <none> (not requested)
Tigris: <none> (not requested)
? Do you want to tweak these settings before proceeding? No
Warning: This organization has no payment method, turning off high availability
Created app '************' in organization 'personal'
Admin URL: ********
Hostname: *******
Wrote config file fly.toml
PS X:\sample>
Running the same with a C# project works as expected
PS X:\> dotnet new web -o Sample2
The template "ASP.NET Core Empty" was created successfully.
Processing post-creation actions...
Restoring X:\Sample2\Sample2.csproj:
Determining projects to restore...
Restored X:\Sample2\Sample2.csproj (in 144 ms).
Restore succeeded.
PS X:\> cd Sample2
PS X:\Sample2> dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5137
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: X:\Sample2
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
PS X:\Sample2> fly launch
Scanning source code
Detected a .NET app
Warning: This organization has no payment method, turning off high availability
Creating app in X:\Sample2
We're about to launch your .NET app on Fly.io. Here's what you're getting:
Organization: ********* (fly launch defaults to the personal org)
Name: ********* (generated)
Region: Stockholm, Sweden (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres: <none> (not requested)
Redis: <none> (not requested)
Tigris: <none> (not requested)
? Do you want to tweak these settings before proceeding? No
Warning: This organization has no payment method, turning off high availability
Created app '*********' in organization 'personal'
Admin URL: ***********
Hostname: ***********
Wrote config file fly.toml
Validating X:\Sample2\fly.toml
✓ Configuration is valid
==> Building image
The culprit likely is in this file here: https://github.com/superfly/flyctl/blob/8fb314c9230ba972453b5ebf292214d10f076468/scanner/dotnet.go#L12-L14 and https://github.com/superfly/flyctl/blob/8fb314c9230ba972453b5ebf292214d10f076468/scanner/dotnet.go#L60-L64
where it is checking explicitly for *.csproj, both C# and F# (and even VB.NET) share the same file format and contents in the project files to truly support .NET apps (and not just C#) the glob/regex expresion should check for any of the *.fsproj, *.csproj (and even *.vbproj should work tbh same tooling) file formats instead as copying the files generated for the C# project in the F# project and then running fly deploy works as expected