Bagaboo
Bagaboo

Reputation: 363

How can i get rid of UAC prompt after deployment

I have written a very small application and am struggeling to create a good deployment project for my solution. It is a wpf application that accesses a database, reformats some data, presents it to the user and writes it as an XML depending on user choises for another application to continue the work. Everything works incredibly fine.

But...

When i create an InstallShield LE project and deploy, i can run the application without a UAC prompt.

When i create a WiX project and deploy, i get a UAC prompt both when i install and when i run the installed application. Every time.

I have searched, and searched and asked around with no working solution.

Any advise?

Upvotes: 0

Views: 683

Answers (2)

Ian Boyd
Ian Boyd

Reputation: 256991

Add an assembly manifest to your executable that tells Windows that you want it to run asInvoke:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
    <assemblyIdentity 
            version="1.0.0.0"
            processorArchitecture="X86"
            name="Contoso.Frobber"
            type="win32"
    />

    <description>Frobber Thingy Majiggy</description> 

    <!-- Disable file and registry virtualization -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
            </requestedPrivileges>
        </security>
    </trustInfo>

</assembly>

This tells Windows that you do not want to elevate.

Upvotes: 0

PhilDW
PhilDW

Reputation: 20790

You'll need to show some of your WiX source and look at the application.

There's no reason for the install itself to influence the behavior of the app. An app will ask for elevation if it contains an elevation manifest, and a requested execution level of requiresAdministrator (or highestAvailable) would be responsible for the UAC prompt. A manifest is usually embedded in the executable, and clearly neither IS or WiX is going to change the content of an exe when it's installed.

So for the app:

  1. Your app build may be different in the two scenarios, one containing an embedded manifest and one not. If open the exe as a file with Visual Studio you might see an RT_MANIFEST node that shows the embedded manifest and its elevation requirements.

  2. The builds may be different because the WiX one includes an external app manifest file that causes elevation prompt when the app runs.

  3. You may have a manifest that elevates if the user is an admin (highestAvaIlable) so an admin will get a prompt, a limited user will not. So different users see differentr behavior.

Difference between "highestAvailable" and "requireAdministrator" in manifest in terms of Elevation?

For the install itself:

  1. The InstallShield setup may be per user (not requiring elevation) and the WiX one is per machine, or at least the WiX has an InstallPrivileges of elevated, either by default or because its explicit in the Package element.

Upvotes: 3

Related Questions