Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare PowerShell Module for Release Build #2768

Merged
merged 8 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 10 additions & 2 deletions src/PowerShell/Microsoft.WinGet.Client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion src/WinGetServer/WinGetServer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/WinGetServer/WinGetServerManualActivation_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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'">
Expand Down Expand Up @@ -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" />
Expand Down