3

I am creating a .NET6 WinUI application which works and runs fine when built and executed via Visual Studio 2022.

If I try to build via the cli (dotnet build) I get an error that Microsoft.DesktopBridge.props is not found.

error MSB4019: Das importierte Projekt "C:\Program Files\dotnet\sdk\6.0.100\Microsoft\DesktopBridge\Microsoft.DesktopBridge.props" wurde nicht gefunden. Stellen Sie sicher, dass der Ausdruck in der Import-Deklaration "C:\Program Files\dotnet\sdk\6.0.100\\Microsoft\DesktopBridge\\Microsoft.DesktopBridge.props" richtig ist und dass die Datei auf dem Datenträger vorhanden ist.

The file doesn't exist at that location but at C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\DesktopBridge, in the install directory of my VS 2022 installation.

If I fix the path in my wapproj file, the build error disappears (but the build fails with other errors).

I don't understand why it's working out of Visual Studio but not via the cli. Do I need to provide additional arguments? Is there a way to see the commands that Visual Studio executes when building/packaging? I appreciate any help or links to documentation about this that I might have missed.

I also tried to create a blank project, error is the same.

My tool setup:

  • VS 17.0.1 (2022)
  • NET 6.0.100
  • Project Reunion VS Extension 0.8.4
  • all versions are stable, no previews

My wapproj file:

<?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|x86">
      <Configuration>Debug</Configuration>
      <Platform>x86</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x86">
      <Configuration>Release</Configuration>
      <Platform>x86</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|arm64">
      <Configuration>Debug</Configuration>
      <Platform>arm64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|arm64">
      <Configuration>Release</Configuration>
      <Platform>arm64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup>
    <WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
    <PathToXAMLWinRTImplementations>TabernaMenuManager.WinUI\</PathToXAMLWinRTImplementations>
  </PropertyGroup>
  <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
  <PropertyGroup>
    <ProjectGuid>4daf556a-da6a-4595-a33d-22575a214f99</ProjectGuid>
    <TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <AssetTargetFallback>net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
    <DefaultLanguage>de-DE</DefaultLanguage>
    <AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
    <EntryPointProjectUniqueName>..\TabernaMenuManager.WinUI\TabernaMenuManager.WinUI.csproj</EntryPointProjectUniqueName>
  </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" />
    <Content Include="Resources\taberna-276414-firebase-adminsdk-w1rvp-4fff3fa7cf.json" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\TabernaMenuManager.WinUI\TabernaMenuManager.WinUI.csproj">
      <SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
      <PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.4]">
      <IncludeAssets>build</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.4]">
      <IncludeAssets>build</IncludeAssets>
    </PackageReference>
  </ItemGroup>
  <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
xmashallax
  • 1,673
  • 1
  • 17
  • 34

0 Answers0