I am trying to package a WinForms app. I am able to build and get MSIX package via Visual Studio. The problem arise when this is committed to Linux pipeline. It fails on build, since its unable to restore package references to get the following package,
.dotnet/sdk/6.0.417/Microsoft/DesktopBridge/Microsoft.DesktopBridge.props
Build fail as below,
/runner/_work/WinPackageMSIX/WinPackageMSIX.wapproj(19,3): error MSB4019: The imported project "/runner/_work/.dotnet/sdk/6.0.417/Microsoft/DesktopBridge/Microsoft.DesktopBridge.props" was not found. Confirm that the expression in the Import declaration "/runner/_work/.dotnet/sdk/6.0.417/Microsoft/DesktopBridge//Microsoft.DesktopBridge.props" is correct, and that the file exists on disk.
WinPackageMSIX.wapproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>dcc67232-cf92-4498-92c1-2281dc72320b</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<NoWarn>$(NoWarn);NU1702</NoWarn>
<EntryPointProjectUniqueName>..\..\src\WinForms\WinForms.csproj</EntryPointProjectUniqueName>
<PackageCertificateKeyFile>1B7886C50F577F6DBA492ED28145D20BE20546</PackageCertificateKeyFile>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Never</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AppxBundle>Never</AppxBundle>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WinForms\WinForms.csproj" />
</ItemGroup>
</Project>
I got a similar problem, but not on linux.
In my case an old msbuild.exe (version 16) was used which did not support my Universal App Project. (Which i used to wrap WPF & WinForms App)
It worked after setting it manually to my visual studio 2022 msbuild.exe (version 17).
(I still received a second exception regarding the RuntimeIdentifier of a side project e.g.: \project.assets.json' doesn't have a target for 'netstandard2.0/win-x64'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.
But that one was easy to fix by adding win-x64 to the project file)
Hopefully this helps you out.