You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call CompileAssemblyFromFile on my provider instance, the program throws the following error stack trace:
Unhandled Exception: System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at FSharp.Compiler.CodeDom.Internal.Compiler.compileFiles(String args, CompilerResults res)
at FSharp.Compiler.CodeDom.Internal.Compiler.compileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames, CompilerResults results, FSharpFunc`2 sortf)
at Program.main(String[] argv)
This occurs despite the fact that System.IO.File.Exists returns true when passed in the file path.
Here is the full code:
open System.IO
open System.CodeDom.Compiler
open FSharp.Compiler.CodeDom
[<EntryPoint>]
let main argv =
let sourceFilePath = Array.get argv 0
if File.Exists(sourceFilePath) then
let provider = new FSharpCodeProvider()
let mutable compilerParameters = CompilerParameters()
compilerParameters.GenerateInMemory <- true
provider.CompileAssemblyFromFile(compilerParameters, [| sourceFilePath |])
|> ignore
else
printf "File does not exist"
0
Sorry I'm so late in replying to this. May I ask how you're using this package with .NET Core? FCS is a better, well-supported option for F#; this package really exists for legacy compatibility at this point...
Unfortunately, I'm no longer working at the company where I was trying to do this and no longer have access to the machine I was developing on, so I can't answer your question. I'll just go ahead and close the issue. Thanks!
Description
When I call
CompileAssemblyFromFile
on my provider instance, the program throws the following error stack trace:This occurs despite the fact that
System.IO.File.Exists
returns true when passed in the file path.Here is the full code:
Here is my
fsproj
file:Repro steps
dotnet new console -lang F#
.cd
into the application directory.Program.fs
.<application>.fsproj
.dotnet build
(succeeds).foo.fs
. I used the following:dotnet run foo.fs
Expected behavior
The program executes without throwing an exception.
Actual behavior
The program throws
System.ComponentModel.Win32Exception
with the above stack trace.Known workarounds
No known workarounds.
Related information
master
? (installed from nuget)dotnet --version
returns '3.0.100'The text was updated successfully, but these errors were encountered: