From 547173541901ebf1c6d9a8dd6864f8e65ae69b25 Mon Sep 17 00:00:00 2001
From: Arjun Balgovind <32061677+arjunbalgovind@users.noreply.github.com>
Date: Fri, 8 May 2020 09:07:18 -0700
Subject: [PATCH] Fix double compile issue for Launcher and Settings (#2759)
* Fix double compile issue
* Removed debugging code
* added prebuild event
* Updated output folders
---
.../PowerToysSetup/PowerToysSetup.wixproj | 71 +++++++++++++++++++
installer/PowerToysSetup/Product.wxs | 4 +-
src/core/Directory.Build.targets | 5 ++
...rosoft.PowerToys.Settings.UI.Runner.csproj | 4 --
src/modules/launcher/Directory.Build.targets | 2 +
.../PowerLauncher/PowerLauncher.csproj | 4 --
src/modules/launcher/Wox.Core/Wox.Core.csproj | 4 +-
.../Wox.Infrastructure.csproj | 4 +-
.../launcher/Wox.Plugin/Wox.Plugin.csproj | 4 +-
src/modules/launcher/Wox.Test/Wox.Test.csproj | 4 +-
src/modules/launcher/Wox/Wox.csproj | 4 +-
11 files changed, 90 insertions(+), 20 deletions(-)
create mode 100644 src/core/Directory.Build.targets
diff --git a/installer/PowerToysSetup/PowerToysSetup.wixproj b/installer/PowerToysSetup/PowerToysSetup.wixproj
index d1a2eeb484..8b2e3a0004 100644
--- a/installer/PowerToysSetup/PowerToysSetup.wixproj
+++ b/installer/PowerToysSetup/PowerToysSetup.wixproj
@@ -69,6 +69,77 @@
+
+
+ setlocal enableDelayedExpansion
+
+rem Publish Settings
+SET settingsProfileFolderName=..\..\..\..\src\core\Microsoft.PowerToys.Settings.UI.Runner\Properties\PublishProfiles\
+rem Create the publish profile folder if it doesn%27t exist
+IF NOT EXIST !settingsProfileFolderName! (mkdir !settingsProfileFolderName!)
+SET settingsProfileFileName=SettingsProfile.pubxml
+SET settingsPublishProfile=!settingsProfileFolderName!!settingsProfileFileName!
+
+rem Create the publish profile pubxml
+echo ^<%3fxml version="1.0" encoding="utf-8"%3f^> > !settingsPublishProfile!
+echo ^<^^!-- >> !settingsPublishProfile!
+echo https://go.microsoft.com/fwlink/%3fLinkID=208121. >> !settingsPublishProfile!
+echo --^> >> !settingsPublishProfile!
+echo ^<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"^> >> !settingsPublishProfile!
+echo ^<PropertyGroup^> >> !settingsPublishProfile!
+echo ^<PublishProtocol^>FileSystem^</PublishProtocol^> >> !settingsPublishProfile!
+echo ^<Configuration^>$(ConfigurationName)^</Configuration^> >> !settingsPublishProfile!
+echo ^<Platform^>$(PlatformName)^</Platform^> >> !settingsPublishProfile!
+echo ^<TargetFramework^>netcoreapp3.1^</TargetFramework^> >> !settingsPublishProfile!
+echo ^<PublishDir^>..\..\..\$(PlatformName)\$(ConfigurationName)\SettingsUIRunner^</PublishDir^> >> !settingsPublishProfile!
+echo ^<RuntimeIdentifier^>win-x64^</RuntimeIdentifier^> >> !settingsPublishProfile!
+echo ^<SelfContained^>false^</SelfContained^> >> !settingsPublishProfile!
+echo ^<PublishSingleFile^>False^</PublishSingleFile^> >> !settingsPublishProfile!
+echo ^<PublishReadyToRun^>False^</PublishReadyToRun^> >> !settingsPublishProfile!
+echo ^</PropertyGroup^> >> !settingsPublishProfile!
+echo ^</Project^> >> !settingsPublishProfile!
+
+rem In case of Release we should not use Debug CRT in VCRT forwarders
+IF $(ConfigurationName)==Release (
+"$(MSBuildBinPath)\msbuild.exe" ..\..\..\..\src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj -t:Publish -p:Configuration="$(ConfigurationName)" -p:Platform="$(PlatformName)" -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=!settingsProfileFileName!
+) ELSE (
+"$(MSBuildBinPath)\msbuild.exe" ..\..\..\..\src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj -t:Publish -p:Configuration="$(ConfigurationName)" -p:Platform="$(PlatformName)" -p:AppxBundle=Never -p:PublishProfile=!settingsProfileFileName!
+)
+
+rem Publish Launcher
+SET launcherProfileFolderName=..\..\..\..\src\modules\launcher\PowerLauncher\Properties\PublishProfiles\
+
+rem Create the publish profile folder if it doesn%27t exist
+IF NOT EXIST !launcherProfileFolderName! (mkdir !launcherProfileFolderName!)
+SET launcherProfileFileName=LauncherProfile.pubxml
+SET launcherPublishProfile=!launcherProfileFolderName!!launcherProfileFileName!
+
+rem Create the publish profile pubxml
+echo ^<%3fxml version="1.0" encoding="utf-8"%3f^> > !launcherPublishProfile!
+echo ^<^^!-- >> !launcherPublishProfile!
+echo https://go.microsoft.com/fwlink/%3fLinkID=208121. >> !launcherPublishProfile!
+echo --^> >> !launcherPublishProfile!
+echo ^<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"^> >> !launcherPublishProfile!
+echo ^<PropertyGroup^> >> !launcherPublishProfile!
+echo ^<PublishProtocol^>FileSystem^</PublishProtocol^> >> !launcherPublishProfile!
+echo ^<Configuration^>$(ConfigurationName)^</Configuration^> >> !launcherPublishProfile!
+echo ^<Platform^>$(PlatformName)^</Platform^> >> !launcherPublishProfile!
+echo ^<TargetFramework^>netcoreapp3.1^</TargetFramework^> >> !launcherPublishProfile!
+echo ^<PublishDir^>..\..\..\..\$(PlatformName)\$(ConfigurationName)\modules\launcher^</PublishDir^> >> !launcherPublishProfile!
+echo ^<RuntimeIdentifier^>win-x64^</RuntimeIdentifier^> >> !launcherPublishProfile!
+echo ^<SelfContained^>false^</SelfContained^> >> !launcherPublishProfile!
+echo ^<PublishSingleFile^>False^</PublishSingleFile^> >> !launcherPublishProfile!
+echo ^<PublishReadyToRun^>False^</PublishReadyToRun^> >> !launcherPublishProfile!
+echo ^</PropertyGroup^> >> !launcherPublishProfile!
+echo ^</Project^> >> !launcherPublishProfile!
+
+rem In case of Release we should not use Debug CRT in VCRT forwarders
+IF $(ConfigurationName)==Release (
+"$(MSBuildBinPath)\msbuild.exe" ..\..\..\..\src\modules\launcher\PowerLauncher\PowerLauncher.csproj -t:Publish -p:Configuration="$(ConfigurationName)" -p:Platform="$(PlatformName)" -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=!launcherProfileFileName!
+) ELSE (
+"$(MSBuildBinPath)\msbuild.exe" ..\..\..\..\src\modules\launcher\PowerLauncher\PowerLauncher.csproj -t:Publish -p:Configuration="$(ConfigurationName)" -p:Platform="$(PlatformName)" -p:AppxBundle=Never -p:PublishProfile=!launcherProfileFileName!
+)
+
-
+
@@ -730,7 +730,7 @@
-
+
diff --git a/src/core/Directory.Build.targets b/src/core/Directory.Build.targets
new file mode 100644
index 0000000000..742af06995
--- /dev/null
+++ b/src/core/Directory.Build.targets
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj
index 619915a358..4741890862 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj
@@ -71,8 +71,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/launcher/Directory.Build.targets b/src/modules/launcher/Directory.Build.targets
index 3aa2a46b34..058d64ca4d 100644
--- a/src/modules/launcher/Directory.Build.targets
+++ b/src/modules/launcher/Directory.Build.targets
@@ -8,4 +8,6 @@
+
+
\ No newline at end of file
diff --git a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj
index dde6a02d0e..c1365402eb 100644
--- a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj
+++ b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj
@@ -192,8 +192,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/launcher/Wox.Core/Wox.Core.csproj b/src/modules/launcher/Wox.Core/Wox.Core.csproj
index ed43594791..a4f2eb9c2b 100644
--- a/src/modules/launcher/Wox.Core/Wox.Core.csproj
+++ b/src/modules/launcher/Wox.Core/Wox.Core.csproj
@@ -15,7 +15,7 @@
true
- ..\..\..\..\x64\Debug\modules\launcher\
+ ..\..\..\..\x64\Debug\modules\launcher\WoxCore
DEBUG;TRACE
full
x64
@@ -27,7 +27,7 @@
- ..\..\..\..\x64\Release\modules\launcher\
+ ..\..\..\..\x64\Release\modules\launcher\WoxCore
TRACE
true
pdbonly
diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
index 217ee74eb1..2f7951938d 100644
--- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
+++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj
@@ -15,7 +15,7 @@
true
- ..\..\..\..\x64\Debug\modules\launcher\
+ ..\..\..\..\x64\Debug\modules\launcher\WoxInfrastructure
DEBUG;TRACE
true
full
@@ -28,7 +28,7 @@
- ..\..\..\..\x64\Release\modules\launcher\
+ ..\..\..\..\x64\Release\modules\launcher\WoxInfrastructure
TRACE
true
pdbonly
diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj
index 9a32103df9..1845c2714b 100644
--- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj
+++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj
@@ -16,7 +16,7 @@
true
- ..\..\..\..\x64\Debug\modules\launcher\
+ ..\..\..\..\x64\Debug\modules\launcher\WoxPlugin
DEBUG;TRACE
full
x64
@@ -28,7 +28,7 @@
- ..\..\..\..\x64\Release\modules\launcher\
+ ..\..\..\..\x64\Release\modules\launcher\WoxPlugin
TRACE
true
pdbonly
diff --git a/src/modules/launcher/Wox.Test/Wox.Test.csproj b/src/modules/launcher/Wox.Test/Wox.Test.csproj
index 3c6144178a..12a35fbdef 100644
--- a/src/modules/launcher/Wox.Test/Wox.Test.csproj
+++ b/src/modules/launcher/Wox.Test/Wox.Test.csproj
@@ -14,7 +14,7 @@
true
- ..\..\..\..\x64\Debug\modules\launcher\
+ ..\..\..\..\x64\Debug\modules\launcher\WoxTest
DEBUG;TRACE
full
x64
@@ -27,7 +27,7 @@
- ..\..\..\..\x64\Release\modules\launcher\
+ ..\..\..\..\x64\Release\modules\launcher\WoxTest
TRACE
true
pdbonly
diff --git a/src/modules/launcher/Wox/Wox.csproj b/src/modules/launcher/Wox/Wox.csproj
index 138b869b6e..04e832ed12 100644
--- a/src/modules/launcher/Wox/Wox.csproj
+++ b/src/modules/launcher/Wox/Wox.csproj
@@ -15,7 +15,7 @@
- ..\..\..\..\x64\Debug\modules\launcher\
+ ..\..\..\..\x64\Debug\modules\launcher\Wox
DEBUG;TRACE
full
x64
@@ -28,7 +28,7 @@
- ..\..\..\..\x64\Release\modules\launcher\
+ ..\..\..\..\x64\Release\modules\launcher\Wox
TRACE;RELEASE
true
pdbonly