commit 6140e6235c21feda291753766b29191ca19d0f02
parent 81765e12703249623c9f33e873a342a9a00fcdb1
Author: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com>
Date: Thu, 15 Dec 2022 16:29:40 -0800
Prepare PowerShell Module for Release Build (#2768)
Diffstat:
7 files changed, 31 insertions(+), 42 deletions(-)
diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj
@@ -17,7 +17,7 @@
<DocumentationFile>$(OutputPath)\Microsoft.WinGet.Client.xml</DocumentationFile>
</PropertyGroup>
- <PropertyGroup Condition="'$(WingetUseProdClsids)' == 'true'">
+ <PropertyGroup Condition="'$(UseProdCLSIDs)' == 'true'">
<DefineConstants>USE_PROD_CLSIDS</DefineConstants>
</PropertyGroup>
@@ -85,22 +85,13 @@
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
- <!-- Copy WinRTAct.dll to PowerShell module directory -->
- <PropertyGroup Condition="'$(Platform)' == 'x64'">
- <TargetPlatform>x64</TargetPlatform>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(Platform)' == 'x86'">
- <TargetPlatform>Win32</TargetPlatform>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(Platform)' == 'ARM64'">
- <TargetPlatform>Arm64</TargetPlatform>
- </PropertyGroup>
-
- <Target Name="CopyWinRTAct" AfterTargets="Build" Condition="'$(Platform)' != 'ARM'">
+ <!-- Copy WinRTAct.dll to PowerShell module directory. Relative path to $(OutputPath) used to support AppInstaller build. -->
+ <Target Name="CopyWinRTAct" AfterTargets="AfterBuild" Condition="'$(Platform)' != 'ARM' AND '$(TargetFramework)' == '$(CoreFramework)'">
+ <PropertyGroup>
+ <WinRTActDir>$(OutputPath)..\..\UndockedRegFreeWinRT\</WinRTActDir>
+ </PropertyGroup>
<ItemGroup>
- <WinRTActDll Include="$(SolutionDir)**\$(TargetPlatform)\$(Configuration)\UndockedRegFreeWinRT\winrtact.dll" />
+ <WinRTActDll Include="$(WinRTActDir)winrtact.dll" />
</ItemGroup>
<Message Importance="high" Text="Copying '@(WinRTActDll)'" />
<Copy SourceFiles="@(WinRTActDll)" DestinationFolder="$(OutputPath)" />
diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1
@@ -66,14 +66,11 @@ PowerShellVersion = '5.1.0'
FormatsToProcess = 'Format.ps1xml'
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
-NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'AMD64' -OR $env:PROCESSOR_ARCHITECTURE -like 'IA64') {
- "x64\$PSEdition\Microsoft.WinGet.Client.dll"
-}
-elseif ($env:PROCESSOR_ARCHITECTURE -like 'ARM64') {
- "ARM64\$PSEdition\Microsoft.WinGet.Client.dll"
+NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'x86') {
+ "x86\$PSEdition\Microsoft.WinGet.Client.dll"
}
else {
- "x86\$PSEdition\Microsoft.WinGet.Client.dll"
+ "x64\$PSEdition\Microsoft.WinGet.Client.dll"
}
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md
@@ -2,11 +2,19 @@
This project contains the source code for building the Windows Package Manager PowerShell Module.
-## Running the PowerShell Module Locally
+## Building the PowerShell Module Locally
After building the project solution, the `Microsoft.WinGet.Client` PowerShell module can be found in the output directory in the `PowerShell` folder. For example if you built the project as x64 release, you should expect to find the module files in `$(SolutionDirectory)/src/x64/Release/PowerShell`.
-To run the module, make sure you are using the latest version of PowerShell (not Windows PowerShell), then import the module manifest (Microsoft.WinGet.Client.psd1).
+## Quick Start Guide
+
+**To run the module, make sure you are using the latest version of PowerShell (not Windows PowerShell)**.
+
+```
+winget install --id Microsoft.Powershell
+```
+
+Import the module manifest (Microsoft.WinGet.Client.psd1) by running the following command:
```
Import-Module <Path to Microsoft.WinGet.Client.psd1">
diff --git a/src/WinGetServer/WinGetServer.vcxproj b/src/WinGetServer/WinGetServer.vcxproj
@@ -149,7 +149,7 @@
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/debug:full /debugtype:cv,fixup /incremental:no %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(WingetEnableReleaseBuild)'=='true'">
+ <ItemDefinitionGroup Condition="'$(UseProdWingetServer)'=='true'">
<ClCompile>
<PreprocessorDefinitions>USE_PROD_WINGET_SERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
diff --git a/src/WinGetServer/WinGetServerManualActivation_Client.cpp b/src/WinGetServer/WinGetServerManualActivation_Client.cpp
@@ -14,7 +14,7 @@
#include <filesystem>
#include <shlobj_core.h>
-#if USE_PROD_WINGET_SERVER
+#ifdef USE_PROD_WINGET_SERVER
const std::wstring_view s_ServerExePath = L"Microsoft\\WindowsApps\\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\\WindowsPackageManagerServer.exe";
#else
const std::wstring_view s_ServerExePath = L"Microsoft\\WindowsApps\\WinGetDevCLI_8wekyb3d8bbwe\\WindowsPackageManagerServerDev.exe";
diff --git a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/Directory.Build.props b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/Directory.Build.props
@@ -1,13 +0,0 @@
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <BuildVersion Condition="'$(BuildVersion)'==''">1.0.0.0</BuildVersion>
- <BuildPlatform>$(Platform)</BuildPlatform>
- <BuildPlatform Condition="'$(Platform)'=='Win32'">x86</BuildPlatform>
- <BuildOutDir Condition="'$(BuildOutDir)'==''">$([System.IO.Path]::GetFullPath('$(SolutionDir)_build\$(BuildPlatform)\$(Configuration)\'))</BuildOutDir>
- <CsWinRTDir>$(BuildOutDir)</CsWinRTDir>
- <CsWinRTDir Condition="'$(Platform)'=='ARM' or '$(Platform)'=='ARM64'">$([System.IO.Path]::GetFullPath('$(SolutionDir)_build\x86\$(Configuration)\'))</CsWinRTDir>
- <CsWinRTExe>$(CsWinRTDir)cswinrt.exe</CsWinRTExe>
- <OutDir>$(BuildOutDir)</OutDir>
- <IntDir>$(OutDir)$(ProjectName)\</IntDir>
- </PropertyGroup>
-</Project>-
\ No newline at end of file
diff --git a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj
@@ -40,6 +40,8 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>UndockedRegFreeWinRT</RootNamespace>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
+ <BuildPlatform>$(Platform)</BuildPlatform>
+ <BuildPlatform Condition="'$(Platform)'=='Win32'">x86</BuildPlatform>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
@@ -70,13 +72,13 @@
<TargetName>winrtact</TargetName>
<LinkIncremental>true</LinkIncremental>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir>$(SolutionDir)$(BuildPlatform)\$(Configuration)\$(ProjectName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>winrtact</TargetName>
<LinkIncremental>false</LinkIncremental>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir>$(SolutionDir)$(BuildPlatform)\$(Configuration)\$(ProjectName)\</OutDir>
<SpectreMitigation>Spectre</SpectreMitigation>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -251,6 +253,11 @@
<ModuleDefinitionFile>winrtact.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(UseProdWingetServer)'=='true'">
+ <ClCompile>
+ <PreprocessorDefinitions>USE_PROD_WINGET_SERVER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<None Include="cpp.hint" />
<None Include="packages.config" />