Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
¿Cómo saber si el script .fsx está siendo ejecutado por .NETCore/.NET5 o por un marco heredado?

Mis scripts .fsx son un poco antiguos, por lo que solo funcionan con .NET4.x, lo que significa que necesito ejecutarlos con el comando fsharpi en macOS.

Ahora estoy pensando en empezar a migrarlos a dotnet fsi ; sin embargo, idealmente puedo encontrar una manera de ejecutarlos en ambos sentidos durante un tiempo, en un período de transición.

Así que esperaba que, dentro de ellos, pudiera hacer algún tipo de código condicional como este:

 #if NET5_0 System.Console.WriteLine "we're running in dotnet fsi, yay" #else System.Console.WriteLine "we're running with fsharpi, legacy" #endif

Pero no funciona, sorprendentemente (y digo sorprendentemente porque la definición NET5_0 se menciona en muchas páginas de documentación). ¿Alguna otra idea de cómo podría detectar esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Creo que System.Environment.Version le dará la información que necesita:

 if System.Environment.Version.Major >= 5 then System.Console.WriteLine "we're running in dotnet fsi, yay" else System.Console.WriteLine "we're running with fsharpi, legacy"

Parece que NET5_0 solo está definido para C#.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!