we have a wpf application which is written with .net core 3.1 . so for forcing wpf to run as admin we added appmanifest file and changed :
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
to
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
and below line added to project.csproj file :
<ApplicationManifest>app.manifest</ApplicationManifest>
after doing all of before step and publishing application we got an error in windows eventviewer : Faulting application name: WpfVideoCourseApp.Presentation.exe, version: 1.0.0.0, time stamp: 0x60776cd9 Faulting module name: KERNELBASE.dll, version: 10.0.19041.1151, time stamp: 0x891df6d3 Exception code: 0xe0434352 Fault offset: 0x0000000000034ed9 Faulting process id: 0x2ac8 Faulting application start time: 0x01d7a5852476cbd1 Faulting application path: E:\VideoCourseApp\WpfVideoCourseApp.Presentation.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: d9b3e20f-55dc-4dd2-b0ad-40e940dedaa6 Faulting package full name: Faulting package-relative application ID:
but afterall i should say that : app runs without any problem when using debug files(problem is all about published version of application)
Update : in publish when i run app , app try to write something in windows document folder and access will denied(but thats not happening when running debug code) actualy i added manifest file for having permission to reading and writing my files in some special path's(like document folder) but it just work in debug