-
Notifications
You must be signed in to change notification settings - Fork 36
Description
So I have another strange behaviour building the wapproj. If "Publish" from VS2022 I go through the wizard and for my x64 target Release (x64) is the only available option and I can only check x64 [which is all what I want]
This will build a msix bundle and compile the referenced windows execuable with release configuration. [context: Which I need because that uses minver to set the correct version number, which I only do in release bacause otherwise hot reload is not working]
But when I build that same wapproj from the command line with:
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild" program.wapproj -p:Configuration=Release -p:Platform=x64It looks like all the logging that scrolls by says "release" in all the paths, but when I start the msix the installed has the corretc version number (which is in the appxmanifest, but the executable did not comile with the Release configuration hence my minver assembly branding was not performed so I get version 1.0.0 instead of the actual version number.
When I then switch the solution to Release and then build using the CLI again, the resulting executable that is installed DOES have the correct version number.
The switch for minver is in a Directory.Build.props file in the repo root, which includes this:
<PropertyGroup>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)'=='Release' AND '$(MSBuildProjectExtension)'!='.wapproj'">
<PackageReference Include="MinVer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="UpdateAssemblyVersion" AfterTargets="MinVer" Condition="'$(Configuration)'=='Release' AND '$(MSBuildProjectExtension)'!='.wapproj'">
<PropertyGroup>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
</PropertyGroup>
</Target>
This makes sure I use x64 and only include minver when in "Release" and the project being build is NOT a .wapproj since wappproj is till old style xml and minver does not support those type of projects. With this minver is includes in all csproj, but not the wapproj projects.
Question: How Can I use the CLI with msbuild to specify a release configuration, where the actual wdinows ewxe project is compiled using that configuration instead of the default soluion configuration. P.S. I'm using the new slnx format for the solution.
Since there a lot of settings in the slnx and csproj and the wapproj I'm not including everything here but when anyone has an idea I can add the relevant information. I did have to change a lot of stuff to get the build process to compile x64 only for alle class libraries and executables.