Microsoft.DesktopBridge.props 项目导入在 Linux 管道构建中失败

问题描述 投票:0回答:1

我正在尝试打包一个 WinForms 应用程序。我能够通过 Visual Studio 构建并获取 MSIX 包。当将其提交给 Linux 管道时,就会出现问题。它在构建时失败,因为它无法恢复包引用以获取以下包,

.dotnet/sdk/6.0.417/Microsoft/DesktopBridge/Microsoft.DesktopBridge.props

构建失败如下,

/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)' &lt; '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>
linux cross-platform msix
1个回答
0
投票

我也遇到了类似的问题,但不是在linux上。

就我而言,使用了旧的 msbuild.exe(版本 16),它不支持我的通用应用程序项目。 (我用来包装 WPF 和 WinForms 应用程序)

手动将其设置为我的 Visual Studio 2022 msbuild.exe(版本 17)后,它起作用了。

(我仍然收到了关于副项目的 RuntimeIdentifier 的第二个异常 例如:\project.assets.json'没有'netstandard2.0/win-x64'的目标。确保恢复已运行并且您已将“netstandard2.0”包含在项目的 TargetFrameworks 中。您可能还需要在项目的 RuntimeIdentifiers 中包含“win-x64”。

但是通过将 win-x64 添加到项目文件中,这个问题很容易修复)

希望这对您有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.