I found a solution for the problem. One can add a RuntimeIdentifier for the whole build as a msBuildArgument like so:
msbuild -restore /property:Configuration=Debug;Platform=x64;RuntimeIdentifier="win-x64"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We need to build a msix package (wapproj) with our DevOps pipeline. We only want to build for platform x64 on windows for the time being. We have a bunch of projects with target framework netstandard2.1 projects and some with net5.0-windows10.0.17763.0.
When building with Visual Studio, we have no problems. But when building with msbuild (locally or on DevOps) we get the following error:
[error]C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): Error NETSDK1047: Assets file 'D:\a\1\s\iv-core\IV.Math\obj\project.assets.json' doesn't have a target for 'netstandard2.1/win-x64'. Ensure that restore has run and that you have included 'netstandard2.1' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.
Setting the runtime identifier in the .cproj file of the to all .netstandard projects lets the build pass, but that cannot be the solution since .netstandard dlls should work on all platforms. What are we missing?
Executable project file referenced by the wapproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows10.0.17763.0</TargetFramework>
<Platform>x64</Platform>
<PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<UseWPF>true</UseWPF>
</PropertyGroup><ItemGroup>
<PackageReference Include="Ninject" Version="3.3.4" />
</ItemGroup><ItemGroup>
<ProjectReference Include="..\iv-core\IV.UI.WPF\IV.UI.WPF.csproj" />
<ProjectReference Include="..\iv-core\IV.Update\IV.Update.csproj" />
</ItemGroup></Project>
One of the referenced csproj that throws the error:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup></Project>
I found a solution for the problem. One can add a RuntimeIdentifier for the whole build as a msBuildArgument like so:
msbuild -restore /property:Configuration=Debug;Platform=x64;RuntimeIdentifier="win-x64"