Skip to content

Commit e000353

Browse files
authored
Resolve nuget package graph for .NET projects together (microsoft#5627)
## Issue When trying to create the actual package containing the MCP server, we found issues in merging the directory contents. Specifically, some common nuget packages were used at different versions. ## Change Reference the MCP project from the configuration server project, forcing the nuget package resolution to consider them as one unit. This also helpfully outputs them as merged already. Also change the name of the directory in the package to reflect the expanded contents.
1 parent ab9eb7e commit e000353

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

src/AppInstallerCLICore/ConfigurationSetProcessorFactoryRemoting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace AppInstaller::CLI::ConfigurationRemoting
2020
namespace
2121
{
2222
// The executable file name for the remote server process.
23-
constexpr std::wstring_view s_RemoteServerFileName = L"ConfigurationRemotingServer\\ConfigurationRemotingServer.exe"sv;
23+
constexpr std::wstring_view s_RemoteServerFileName = L"DotNet\\ConfigurationRemotingServer.exe"sv;
2424

2525
constexpr std::wstring_view s_ProcessorEngine_PowerShell = L"pwsh"sv;
2626
constexpr std::wstring_view s_ProcessorEngine_DSCv3 = L"dscv3"sv;

src/AppInstallerCLIPackage/AppInstallerCLIPackage.wapproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
<Target Name="WinGetIncludeAdditionalFilesInPackage" AfterTargets="_ComputeAppxPackagePayload">
228228
<PropertyGroup>
229229
<WinGetAdditionalPackageFileRoot>$(SolutionDir)</WinGetAdditionalPackageFileRoot>
230+
<WinGetDotNetDirectoryName>DotNet</WinGetDotNetDirectoryName>
230231
</PropertyGroup>
231232
<Message Importance="normal" Text="WinGetAdditionalPackageFileRoot = $(WinGetAdditionalPackageFileRoot)" />
232233
<ItemGroup>
@@ -243,15 +244,11 @@
243244
<PackagePath>Microsoft.Management.Configuration.winmd</PackagePath>
244245
</WinGetAdditionalPackageFile>
245246
<WinGetAdditionalPackageFile Include="$(WinGetAdditionalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\ConfigurationRemotingServer\net8.0-windows10.0.26100.0\$(ConfigServerRid)\**\*">
246-
<PackagePath>ConfigurationRemotingServer</PackagePath>
247-
<Recurse>true</Recurse>
248-
</WinGetAdditionalPackageFile>
249-
<WinGetAdditionalPackageFile Include="$(WinGetAdditionalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\WinGetMCPServer\net8.0-windows10.0.26100.0\$(ConfigServerRid)\**\*">
250-
<PackagePath>WinGetMCPServer</PackagePath>
247+
<PackagePath>$(WinGetDotNetDirectoryName)</PackagePath>
251248
<Recurse>true</Recurse>
252249
</WinGetAdditionalPackageFile>
253250
<WinGetAdditionalPackageFile Include="$(WinGetAdditionalPackageFileRoot)\$(PlatformTarget)\$(Configuration)\Microsoft.Management.Deployment.OutOfProc\Microsoft.Management.Deployment.OutOfProc.dll">
254-
<PackagePath>WinGetMCPServer\Microsoft.Management.Deployment.dll</PackagePath>
251+
<PackagePath>$(WinGetDotNetDirectoryName)\Microsoft.Management.Deployment.dll</PackagePath>
255252
</WinGetAdditionalPackageFile>
256253
<WinGetAdditionalPackageFile Include="$(SolutionDir)\PowerShell\ExternalModules\**\*">
257254
<PackagePath>ExternalModules</PackagePath>

src/AppInstallerCLIPackage/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
</com:Extension>
9898
</Extensions>
9999
</Application>
100-
<Application Id="WinGetMCPServer" Executable="WinGetMCPServer\WinGetMCPServer.exe" EntryPoint="Windows.FullTrustApplication">
100+
<Application Id="WinGetMCPServer" Executable="DotNet\WinGetMCPServer.exe" EntryPoint="Windows.FullTrustApplication">
101101
<uap:VisualElements DisplayName="WinGet Dev MCP Server" Square150x150Logo="Images\MedTile.png" Square44x44Logo="Images\AppList.png" Description="The WinGet MCP server." BackgroundColor="#0078d7" AppListEntry="none" >
102102
<uap:DefaultTile/>
103103
</uap:VisualElements >

src/AppInstallerCommonCore/SelfManagement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace AppInstaller::SelfManagement
1515

1616
// Always use AppInstaller's package family name for wingetdev
1717
static constexpr std::wstring_view s_AppInstallerPfn = L"Microsoft.DesktopAppInstaller_8wekyb3d8bbwe"sv;
18-
constexpr std::wstring_view s_RemoteServerFileName = L"ConfigurationRemotingServer\\ConfigurationRemotingServer.exe";
18+
constexpr std::wstring_view s_RemoteServerFileName = L"DotNet\\ConfigurationRemotingServer.exe";
1919

2020
bool IsStubPreferred()
2121
{

src/ConfigurationRemotingServer/ConfigurationRemotingServer.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<ItemGroup>
3434
<ProjectReference Include="..\Microsoft.Management.Configuration.Processor\Microsoft.Management.Configuration.Processor.csproj" />
3535
<ProjectReference Include="..\Microsoft.Management.Configuration\Microsoft.Management.Configuration.vcxproj" />
36+
<!-- Pull in any other .NET projects that need to ship with the package so that they can resolve the nuget graph together and land in the same output location. -->
37+
<ProjectReference Include="..\WinGetMCPServer\WinGetMCPServer.csproj" />
3638
</ItemGroup>
3739

3840
<Target Name="PwshFiles" AfterTargets="AfterBuild">

src/targets/ReferenceEmbeddedCsWinRTProject.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<!--Do not publish projection source winmd files, but do include implementation dlls -->
1818
<ReferenceCopyLocalPaths Remove="@(WinGetRemovedReferences)" />
1919
<ReferenceCopyLocalPaths Include="@(WinGetRemovedReferences->'%(RootDir)%(Directory)%(DestinationSubDirectory)%(Implementation)')"
20-
Condition="'%(WinGetRemovedReferences.Implementation)' != '' AND Exists('%(WinGetRemovedReferences.RootDir)%(WinGetRemovedReferences.Directory)%(WinGetRemovedReferences.DestinationSubDirectory)%(WinGetRemovedReferences.Implementation)')" />
20+
Condition="'%(WinGetRemovedReferences.Implementation)' != '' AND '$([System.IO.Path]::GetExtension(%(WinGetRemovedReferences.Implementation)))' == '.dll' AND Exists('%(WinGetRemovedReferences.RootDir)%(WinGetRemovedReferences.Directory)%(WinGetRemovedReferences.DestinationSubDirectory)%(WinGetRemovedReferences.Implementation)')" />
2121
<!--Remove winmd references from deps.json to prevent CLR failing unit test execution-->
2222
<ReferenceDependencyPaths Remove="@(ReferenceDependencyPaths)" Condition="%(ReferenceDependencyPaths.Extension) == '.winmd'"/>
2323
</ItemGroup>
@@ -36,4 +36,11 @@
3636
<ResolvedCompileFileDefinitions Remove="@(ResolvedCompileFileDefinitions)" Condition="'$([System.IO.Path]::GetFileName(%(HintPath)))' == 'WinRT.Runtime.dll'"/>
3737
</ItemGroup>
3838
</Target>
39+
40+
<!-- Remove any items from ReferenceCopyLocalPaths that have CopyLocal set to false. -->
41+
<Target Name="WinGetRemoveCopyLocalReferencesAsNeeded" AfterTargets="WinGetRemoveWinMDReferences">
42+
<ItemGroup>
43+
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="%(ReferenceCopyLocalPaths.CopyLocal) == 'false'" />
44+
</ItemGroup>
45+
</Target>
3946
</Project>

0 commit comments

Comments
 (0)