microsoft-ui-xaml
microsoft-ui-xaml copied to clipboard
Unable To set UAC Settings when Self Contained
Describe the bug
In my .csproj, I have set <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
then, in my app.manifest, I have set <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
When I build, I get the error:
c1010001 Values of attribute "level" not equal in different manifest snippets.
full .csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Sangam.Configurator</RootNamespace>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Company>Knightwatch</Company>
<WindowsPackageType>None</WindowsPackageType>
<SelfContained>true</SelfContained>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<ResourceLanguages>en</ResourceLanguages>
<StartupObject>Sangam.Configurator.Program</StartupObject>
<Nullable>enable</Nullable>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Animations" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Media" Version="7.1.2" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0" />
<PackageReference Include="WinUIValidation" Version="1.0.5" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sangam.Core\Sangam.Core.csproj" />
<ProjectReference Include="..\Sangam.Service\Sangam.Service.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AvigilonSdkDotNet">
<HintPath>..\Sangam.Refrences\AvigilonSdkDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo "Stopping and Removing Service"
sc stop "Sangam.Service"
sc delete "Sangam.Service"
exit 0" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo "Installing and Starting Service"
sc create "Sangam.Service" binpath="$(TargetDir)Sangam.Service.exe"
sc qc "Sangam.Service"
sc start "Sangam.Service"
exit 0" />
</Target>
</Project>
app.manifest:
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Sangam.Configurator.app"/>
<description>Sangam Configuration Utility</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and Windows 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>
Steps to reproduce the bug
Create a new Blank Unpackaged WinUI App.
Add <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> to your .csproj
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.1.1
Windows app type
- [ ] UWP
- [X] Win32
Device form factor
Desktop
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
Getting same issue when setting UAC Settings
c1010001 Values of attribute "level" not equal in different manifest snippets.
MSB3073 The command ""C:\Users\ravichandra.t\.nuget\packages\microsoft.windows.sdk.buildtools\10.0.22621.1\bin\10.0.22621.0\x64\mt.exe" -nologo -manifest
"*****(Path)****\RestartTest\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\\Manifests\app.manifest" "app.manifest"
C:\Users\ravichandra.t\.nuget\packages\microsoft.windowsappsdk\1.1.3\manifests\Microsoft.InteractiveExperiences.manifest
C:\Users\ravichandra.t\.nuget\packages\microsoft.windowsappsdk\1.1.3\manifests\Microsoft.WindowsAppSdk.Foundation.manifest
-out:
"*****(Path)****\RestartTest\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\\Manifests\mergeapp.manifest""
exited with code 31.
It looks like there is an conflict while merging the "*(Path)****\RestartTest\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\Manifests\app.manifest" and "app.manifest"(Application Manifest file).
In the "*(Path)****\RestartTest\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\Manifests\app.manifest", irrespective of changes in the application manifest, it will be always "asInvoker" , is there any way to set this to required value?