Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Application Compatibilty Manifest for new Visual-Studio projects?

Tags:

I'm currently fighting with some app compat settings, specifically a certain shim, and looking into the compatibilty section of the application manifest.

Details aside, one thing that strikes me as odd is that, even with Visual Studio 2015, there doesn't seem to be any default for the application compatibility manifest(*) -- or rather, default is none, thereby defaulting to "Windows Vista" wrt. the stuff listed in Application Manifest.

This seems totally odd to me, but maybe I'm missing something:

Every new application in either Visual-C++/Native or C# that is newly created by any team that is not aware of this stuff (and I daresay there's a lot of such teams) will run in Windows Vista compatibility mode. Is this actually the case? Is there a rationale for this?


(*):

...
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
  <application> 
    <supportedOS Id="{...}"/>

And while I'm at it: Good overview

  • List of Windows 7 vs. Vista compatibility bullets
  • For Windows 8
  • For Windows 8.1
  • For Windows 10(?)
like image 960
Martin Ba Avatar asked May 20 '16 13:05

Martin Ba


1 Answers

Yes, newly created projects (I only verified .NET projects, no native C++) in Visual Studio 2015 will have no compatibility section and will run under Windows Vista context, as you correctly said. It's easy to check. If you create new console (for example) project and go to project properties -> application, you will see that in manifest section the following is stated by default: "Embed manifest with default settings". What's that manifest with default settings? Build console project and look with any resource viewer and you'll find:

<?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" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

As you see, no compatibility section. Then run that console project (put Console.ReadKey() for it to not exit immediatly). Open Resource Monitor (resmon), go to CPU section and add column "Operating System Context". You will see "Windows Vista" at that column for your fresh console application - so it's definetly runs under Windows Vista context.

As for rationale - I can only make assumptions about that, here is one. The goal of compatibility section is stated as:

This section helps Windows determine the versions of Windows that an application was designed to target

When you create new project in Visual Studio it is not known if it was designed (which means - tested on) specific version of Windows with the knowledge of behavior changes introduced in later versions of Windows - so a safe approach was taken to default to behavior which is the same on all versions of Windows (starting with Vista) - as opposite to default to behavior which is different on different versions of Windows. With different behavior you (ideally) should test your application on all versions of Windows you support. When behavior is the same - you can test on any one version.

So it's reasonable to provide the same behavior for developers who are not aware of those behavior changes - their application tested on Windows version of their choice will happily run on other versions (regarding features related to compatibility section mentioned).

like image 76
Evk Avatar answered Sep 28 '22 03:09

Evk