Skip to content

Commit

Permalink
Fix #894: do output a dummy DLL in BundleOnly mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Feb 1, 2018
1 parent 6634534 commit 020f550
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/compiler/WebSharper.FSharp/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ open ErrorPrinting
exception ArgumentError of string
let argError msg = raise (ArgumentError msg)

/// In BundleOnly mode, output a dummy DLL to please MSBuild
let MakeDummyDll (path: string) (assemblyName: string) =
let aND = Mono.Cecil.AssemblyNameDefinition(assemblyName, Version())
let asm = Mono.Cecil.AssemblyDefinition.CreateAssembly(aND, assemblyName, Mono.Cecil.ModuleKind.Dll)
asm.Write(path)

open Microsoft.FSharp.Compiler.SourceCodeServices
let Compile (config : WsConfig) (warnSettings: WarnSettings) =
StartTimer()
Expand Down Expand Up @@ -61,7 +67,10 @@ let Compile (config : WsConfig) (warnSettings: WarnSettings) =
let isBundleOnly = config.ProjectType = Some BundleOnly

let exitCode =
if isBundleOnly then 0 else
if isBundleOnly then
MakeDummyDll config.AssemblyFile thisName
0
else
let errors, exitCode =
checker.Compile(config.CompilerArgs) |> Async.RunSynchronously

Expand Down
2 changes: 1 addition & 1 deletion tests/WebSharper.SPA.Tests/WebSharper.SPA.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<Name>WebSharper.SPA.Tests</Name>
<WebSharperProject>Bundle</WebSharperProject>
<WebSharperProject>BundleOnly</WebSharperProject>
<FSharp40>True</FSharp40>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<Tests>True</Tests>
Expand Down

0 comments on commit 020f550

Please sign in to comment.