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

Fix PowerShell module for release configuration #2599

Merged
merged 5 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -69,7 +69,7 @@ protected static IReadOnlyList<PackageCatalogReference> GetPackageCatalogReferen
}
}

[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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
28 changes: 28 additions & 0 deletions src/PowerShell/Microsoft.WinGet.Client/README.md
Original file line number Diff line number Diff line change
@@ -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 `$(ProjectDirectory)/src/x64/Release/PowerShell`.
ryfu-msft marked this conversation as resolved.
Show resolved Hide resolved

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
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>winrtact</TargetName>
<LinkIncremental>true</LinkIncremental>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
ryfu-msft marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>winrtact</TargetName>
<LinkIncremental>true</LinkIncremental>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>winrtact</TargetName>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>winrtact</TargetName>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down
12 changes: 8 additions & 4 deletions src/UndockedRegFreeWinRT/detours/detours.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,23 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down