Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

c# - Program Compatibility Assistant thinks my app is an installer

I have created a .NET C# WinForms application on Win 7 RTM x64, which let's say I have called DataInstaller.

When I run this program outside of the debugger (just an empty form with no functionality at the moment), it works fine until I close the form. I then get a message from the Program Compatibility Assistant that says:

This program might not have installed correctly

I then get the option to reinstall using recommended settings or to say that the install did work as expected.

If I name the app 'DataThingy' this isn't an issue, I guess this is related to the way that programs called *Setup gain a UAC shield icon.

I assume that there will be something simple that I can put in the application manifest to prevent this?

I'm not sure if this occurs on Vista as I don't have access currently.

Changing the name is not an option and turning off UAC is not an option so please don't suggest this!

Edit:

OMG.

It seems that if any of the following are true, UAC sticks its oar in:

Exe name contains the word Installer

AssemblyInfo.cs

AssemblyTitle contains the word 'Installer'
    e.g. [assembly: AssemblyTitle("DataInstaller")]
AssemblyProduct contains the word 'Installer'
    e.g. [assembly: AssemblyProduct("Data Installation Utility")]

'Installer' can also be 'Setup'.

It beggars belief, it really does. Obviously one of the old VB6 programmers got relocated into the UAC team over at Redmond.

I still need a workaround, I'm not prepared to accept that my application can't possibly be an called an installer because it doesn't touch the registry or put any files in the Program Files folder.

I assume that UAC would put the machine into total lockdown if I tried to execute my application called IAmAVirus.exe. (Actually, I daren't try it because I'm not entirely convinced that I'm just being silly)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Add this into your manifest.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
  <application>
    <!--The ID below indicates application support for Windows Vista -->
    <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
    <!--The ID below indicates application support for Windows 7 -->
    <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    <!--The ID below indicates app support for Windows 8 -->
    <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    <!--The ID below indicates app support for Windows 8.1 -->
    <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
  </application>
</compatibility>

The GUIDs for all the operating systems in the previous example provide down-level support. Apps that support multiple platforms do not need separate manifests for each platform.

Taken from App (executable) manifest.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...