winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 02ff0063e824b8cda96b70ab876fcdc8823786d7
parent 3aa7aa444b862d7a186ad13cdc7322c3e6186f07
Author: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com>
Date:   Tue, 18 Oct 2022 13:50:46 -0700

Fix PowerShell module for release configuration (#2599)


Diffstat:
Msrc/IndexCreationTool/IndexCreationTool.csproj | 2+-
Msrc/LocalhostWebServer/LocalhostWebServer.csproj | 2+-
Msrc/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs | 5+++--
Msrc/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 | 4++--
Msrc/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj | 32+++++++++++++++++++++++++++++---
Asrc/PowerShell/Microsoft.WinGet.Client/README.md | 29+++++++++++++++++++++++++++++
Msrc/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj | 16++++++++--------
Msrc/UndockedRegFreeWinRT/detours/detours.vcxproj | 12++++++++----
8 files changed, 81 insertions(+), 21 deletions(-)

diff --git a/src/IndexCreationTool/IndexCreationTool.csproj b/src/IndexCreationTool/IndexCreationTool.csproj @@ -2,7 +2,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net5.0</TargetFramework> + <TargetFramework>net6.0</TargetFramework> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\IndexCreationTool\</OutDir> <Platforms>x64;x86</Platforms> </PropertyGroup> diff --git a/src/LocalhostWebServer/LocalhostWebServer.csproj b/src/LocalhostWebServer/LocalhostWebServer.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> - <TargetFramework>net5.0</TargetFramework> + <TargetFramework>net6.0</TargetFramework> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\LocalhostWebServer\</OutDir> <Platforms>x64;x86</Platforms> </PropertyGroup> diff --git a/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs @@ -69,7 +69,7 @@ namespace Microsoft.WinGet.Client.Common } } - [DllImport("winrtact.dll", EntryPoint = "winrtact_Initialize", ExactSpelling = true, PreserveSig = false)] + [DllImport("winrtact.dll", EntryPoint = "winrtact_Initialize", ExactSpelling = true, PreserveSig = true)] private static extern void InitializeUndockedRegFreeWinRT(); } -} +}+ \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 b/src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 @@ -31,12 +31,12 @@ param ( ) # src\x64\Release\Project\net461\Library.Desktop.dll -# src\x64\Release\Project\net5.0-windows10.0.22000.0\Library.Core.dll +# src\x64\Release\Project\net6.0-windows10.0.22000.0\Library.Core.dll # build\Module\x64\Desktop\Library.Desktop.dll # build\Module\x64\Core\Library.Core.dll -$CoreFramework = 'net5.0-windows10.0.22000.0' +$CoreFramework = 'net6.0-windows10.0.22000.0' $CoreFolderName = 'Core' $DesktopFramework = 'net461' $DesktopFolderName = 'Desktop' diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -2,14 +2,16 @@ <PropertyGroup> <TargetWindowsVersion>10.0.22000.0</TargetWindowsVersion> - <CoreFramework>net5.0-windows$(TargetWindowsVersion)</CoreFramework> + <CoreFramework>net6.0-windows$(TargetWindowsVersion)</CoreFramework> <DesktopFramework>net461</DesktopFramework> </PropertyGroup> <PropertyGroup> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <LangVersion>9</LangVersion> - <OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutputPath> + <BuildOutputDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</BuildOutputDirectory> + <OutputPath>$(BuildOutputDirectory)$(MSBuildProjectName)</OutputPath> + <PowerShellModuleOutputDirectory>$(BuildOutputDirectory)PowerShell</PowerShellModuleOutputDirectory> <Platforms>x64;x86</Platforms> <TargetFrameworks>$(CoreFramework);$(DesktopFramework)</TargetFrameworks> </PropertyGroup> @@ -76,5 +78,29 @@ <Message Importance="high" Text="Copying '@(WinRTActDll)' to '$(OutputPath)'" /> <Copy SourceFiles="@(WinRTActDll)" DestinationFolder="$(OutputPath)" /> </Target> - + + <!-- Build Microsoft.Winget.Client PowerShell Module --> + <Target Name="CopyModuleFiles" AfterTargets="AfterBuild"> + <Message Importance="high" Text="Copying PowerShell module files to '$(PowerShellModuleOutputDirectory)'" /> + <Copy SourceFiles="Format.ps1xml" DestinationFolder="$(PowerShellModuleOutputDirectory)" /> + <Copy SourceFiles="Microsoft.WinGet.Client.psd1" DestinationFolder="$(PowerShellModuleOutputDirectory)" /> + <Copy SourceFiles="Microsoft.WinGet.Client.psm1" DestinationFolder="$(PowerShellModuleOutputDirectory)" /> + </Target> + + <Target Name="CopyCoreBinaries" AfterTargets="AfterBuild" Condition="'$(TargetFramework)' == '$(CoreFramework)'"> + <ItemGroup> + <CoreBinaries Include="$(OutputPath)*" /> + </ItemGroup> + <Message Importance="high" Text="Copying @(CoreBinaries) to '$(PowerShellModuleOutputDirectory)\$(Platform)\Core'" /> + <Copy SourceFiles="@(CoreBinaries)" DestinationFolder="$(PowerShellModuleOutputDirectory)\$(Platform)\Core" /> + </Target> + + <Target Name="CopyDesktopBinaries" AfterTargets="AfterBuild" Condition="'$(TargetFramework)' == '$(DesktopFramework)'"> + <ItemGroup> + <DesktopBinaries Include="$(OutputPath)*" /> + </ItemGroup> + <Message Importance="high" Text="Copying @(DesktopBinaries) to '$(PowerShellModuleOutputDirectory)\$(Platform)\Desktop'" /> + <Copy SourceFiles="@(DesktopBinaries)" DestinationFolder="$(PowerShellModuleOutputDirectory)\$(Platform)\Desktop" /> + </Target> + </Project> \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md @@ -0,0 +1,28 @@ +# Windows Package Manager PowerShell Module + +This project contains the source code for building the Windows Package Manager PowerShell Module. + +## Running 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). + +``` +Import-Module <Path to Microsoft.WinGet.Client.psd1"> +``` + +The following cmdlets and functions are available for you to try: + + Get-WinGetVersion + Enable-WinGetSetting + Disable-WinGetSetting + Add-WinGetSource + Remove-WinGetSource + Reset-WinGetSource + Find-WinGetPackage + Get-WinGetPackage + Get-WinGetSource + Install-WinGetPackage + Uninstall-WinGetPackage + Update-WinGetPackage+ \ No newline at end of file diff --git a/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj b/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj @@ -73,26 +73,26 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <TargetName>winrtact</TargetName> <LinkIncremental>true</LinkIncremental> - <OutDir>$(BuildOutDir)</OutDir> - <IntDir>$(OutDir)$(ProjectName)</IntDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <TargetName>winrtact</TargetName> <LinkIncremental>true</LinkIncremental> - <OutDir>$(BuildOutDir)</OutDir> - <IntDir>$(OutDir)$(ProjectName)</IntDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <TargetName>winrtact</TargetName> <LinkIncremental>false</LinkIncremental> - <OutDir>$(BuildOutDir)</OutDir> - <IntDir>$(OutDir)$(ProjectName)</IntDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <TargetName>winrtact</TargetName> <LinkIncremental>false</LinkIncremental> - <OutDir>$(BuildOutDir)</OutDir> - <IntDir>$(OutDir)$(ProjectName)</IntDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> diff --git a/src/UndockedRegFreeWinRT/detours/detours.vcxproj b/src/UndockedRegFreeWinRT/detours/detours.vcxproj @@ -89,19 +89,23 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> - <IntDir>$(OutDir)$(ProjectName)\</IntDir> - <OutDir>$(BuildOutDir)</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> - <IntDir>$(OutDir)$(ProjectName)\</IntDir> - <OutDir>$(BuildOutDir)</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile>