Skip to content

Commit

Permalink
[All] Disable .NET Welcome message when cracking project
Browse files Browse the repository at this point in the history
  • Loading branch information
MangelMaxime committed Jan 23, 2025
1 parent d4541ba commit 016e1c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/Fable.Cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 5.0.0-alpha.7 - 2025-01-23

### Fixed

* [All] Disable .NET Welcome message when cracking project (#4014) (by @MangelMaxime)

## 5.0.0-alpha.6 - 2025-01-23

### Added
Expand Down
6 changes: 6 additions & 0 deletions src/Fable.Compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 5.0.0-alpha.7 - 2025-01-23

### Fixed

* [All] Disable .NET Welcome message when cracking project (#4014) (by @MangelMaxime)

## 5.0.0-alpha.6 - 2025-01-23

### Added
Expand Down
7 changes: 4 additions & 3 deletions src/Fable.Compiler/MSBuildCrackerResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ module private MSBuildCrackerResolver =
let private dotnet_msbuild_with_defines (fsproj: FullPath) (args: string) (defines: string list) : Async<string> =
backgroundTask {
let psi = ProcessStartInfo "dotnet"
let pwd = Assembly.GetEntryAssembly().Location |> Path.GetDirectoryName

psi.WorkingDirectory <- Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)

psi.Arguments <- $"msbuild \"%s{fsproj}\" %s{args}"
psi.RedirectStandardOutput <- true
psi.RedirectStandardError <- true
psi.UseShellExecute <- false
// Disable Dotnet Welcome message
// https://github.com/fable-compiler/Fable/issues/4014
psi.Environment.Add("DOTNET_NOLOGO", "1")

if not (List.isEmpty defines) then
let definesValue = defines |> String.concat ";"
Expand All @@ -52,10 +54,9 @@ module private MSBuildCrackerResolver =
do! ps.WaitForExitAsync()

let fullCommand = $"dotnet msbuild %s{fsproj} %s{args}"
// printfn "%s" fullCommand

if not (String.IsNullOrWhiteSpace error) then
failwithf $"In %s{pwd}:\n%s{fullCommand}\nfailed with\n%s{error}"
failwithf $"In %s{psi.WorkingDirectory}:\n%s{fullCommand}\nfailed with\n%s{error}"

return output.Trim()
}
Expand Down

0 comments on commit 016e1c3

Please sign in to comment.