<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information. -->
<Rule Name="Application"
      Description="Specifies the project's application settings and properties."
      DisplayName="Application"
      PageTemplate="generic"
      Order="100"
      xmlns="http://schemas.microsoft.com/build/2009/properties">

  <Rule.Categories>
    <Category Name="General"
              DisplayName="General"
              Description="General settings for the application." />
    <Category Name="Resources"
              DisplayName="Resources"
              Description="Resource settings for the application." />
  </Rule.Categories>

  <Rule.DataSource>
    <DataSource Persistence="ProjectFile"
                SourceOfDefaultValue="AfterContext"
                HasConfigurationCondition="False" />
  </Rule.DataSource>

  <StringProperty Name="AssemblyName"
                  DisplayName="Assembly name"
                  Description="Specifies the name of the output file that will hold the assembly manifest."
                  Category="General" />

  <StringProperty Name="RootNamespace"
                  DisplayName="Default namespace"
                  Description="Specifies the base namespace for files added to the project."
                  Category="General" />

  <BoolProperty Name="TargetMultipleFrameworks"
                DisplayName="Target multiple frameworks"
                Description="Build this project for multiple target frameworks."
                HelpUrl="https://go.microsoft.com/fwlink/?linkid=2147236"
                Category="General">
    <BoolProperty.DataSource>
      <DataSource Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </BoolProperty.DataSource>
  </BoolProperty>

  <DynamicEnumProperty Name="TargetFramework"
                       DisplayName="Target framework"
                       Description="Specifies the version of .NET that the application targets. This option can have different values depending on which versions of .NET are installed on your computer."
                       HelpUrl="https://go.microsoft.com/fwlink/?linkid=2147236"
                       Category="General"
                       EnumProvider="SupportedTargetFrameworksEnumProvider"
                       MultipleValuesAllowed="False">
    <DynamicEnumProperty.Metadata>
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(not (evaluated "Application" "TargetMultipleFrameworks"))</NameValuePair.Value>
      </NameValuePair>
      <NameValuePair Name="DependsOn" Value="Application::TargetMultipleFrameworks" />
    </DynamicEnumProperty.Metadata>
  </DynamicEnumProperty>

  <StringProperty Name="TargetFrameworks"
                  DisplayName="Target frameworks"
                  Description="Specifies the semicolon-delimited list of frameworks that this project will target."
                  HelpUrl="https://go.microsoft.com/fwlink/?linkid=2147236"
                  Category="General">
    <StringProperty.DataSource>
      <DataSource Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </StringProperty.DataSource>
    <StringProperty.Metadata>
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(evaluated "Application" "TargetMultipleFrameworks")</NameValuePair.Value>
      </NameValuePair>
      <NameValuePair Name="DependsOn" Value="Application::TargetMultipleFrameworks" />
    </StringProperty.Metadata>
  </StringProperty>

  <StringProperty Name="InstallOtherFrameworks"
                  DisplayName="Install other frameworks">
    <StringProperty.DataSource>
      <DataSource PersistedName="InstallOtherFrameworks"
                  Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </StringProperty.DataSource>
    <StringProperty.ValueEditors>
      <ValueEditor EditorType="LinkAction">
        <ValueEditor.Metadata>
          <NameValuePair Name="Action" Value="URL" />
          <NameValuePair Name="URL" Value="http://go.microsoft.com/fwlink/?LinkID=287120" />
        </ValueEditor.Metadata>
      </ValueEditor>
    </StringProperty.ValueEditors>
  </StringProperty>

  <EnumProperty Name="OutputType"
                DisplayName="Output type"
                Description="Specifies the type of application to build."
                Category="General">
    <EnumValue Name="Library"
               DisplayName="Class Library" />
    <EnumValue Name="Exe"
               DisplayName="Console Application" />
    <EnumValue Name="WinExe"
               DisplayName="Windows Application" />
  </EnumProperty>

  <DynamicEnumProperty Name="StartupObject"
                       DisplayName="Startup object"
                       Description="Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the 'Main' procedure that should run when the application starts. Class libraries do not define an entry point."
                       Category="General"
                       EnumProvider="StartupObjectsEnumProvider">
    <DynamicEnumProperty.Metadata>
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(ne (evaluated "Application" "OutputType") "Library")</NameValuePair.Value>
      </NameValuePair>
    </DynamicEnumProperty.Metadata>
  </DynamicEnumProperty>

  <EnumProperty Name="ResourceSpecificationKind"
                DisplayName="Resources"
                Description="Specifies how application resources will be managed."
                Category="Resources">
    <EnumProperty.DataSource>
      <DataSource PersistedName="ResourceSpecificationKind"
                  Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </EnumProperty.DataSource>
    <EnumValue Name="IconAndManifest"
               DisplayName="Icon and manifest" />
    <EnumValue Name="ResourceFile"
               DisplayName="Resource file" />
  </EnumProperty>

  <StringProperty Name="ApplicationIcon"
                  DisplayName="Icon"
                  Category="Resources"
                  Description="Sets the .ico file that you want to use as your program icon."
                  Subtype="file">
    <StringProperty.Metadata>
      <NameValuePair Name="DependsOn" Value="Application::ResourceSpecificationKind" />
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(eq (evaluated "Application" "ResourceSpecificationKind") "IconAndManifest")</NameValuePair.Value>
      </NameValuePair>
    </StringProperty.Metadata>
  </StringProperty>

  <EnumProperty Name="ApplicationManifestKind"
                DisplayName="Manifest"
                Description="Selects a manifest generation option when the application runs on Windows Vista or later under User Account Control (UAC). Options include a default manifest, no manifest, or a custom manifest provided by your project."
                Category="Resources">
    <EnumProperty.DataSource>
      <DataSource PersistedName="ApplicationManifestKind"
                  Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </EnumProperty.DataSource>
    <EnumProperty.Metadata>
      <NameValuePair Name="DependsOn" Value="Application::ResourceSpecificationKind" />
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(eq (evaluated "Application" "ResourceSpecificationKind") "IconAndManifest")</NameValuePair.Value>
      </NameValuePair>
    </EnumProperty.Metadata>
    <EnumValue Name="DefaultManifest"
               DisplayName="Embed manifest with default settings" />
    <EnumValue Name="NoManifest"
               DisplayName="Create application without a manifest" />
    <EnumValue Name="CustomManifest"
               DisplayName="Use a custom manifest" />
  </EnumProperty>

  <StringProperty Name="ApplicationManifestPath"
                  DisplayName="Manifest path"
                  Description="The path to the custom manifest file."
                  Category="Resources"
                  Subtype="file">
    <StringProperty.DataSource>
      <DataSource PersistedName="ApplicationManifestPath"
                  Persistence="ProjectFileWithInterception"
                  HasConfigurationCondition="False" />
    </StringProperty.DataSource>
    <StringProperty.Metadata>
      <NameValuePair Name="DependsOn" Value="Application::ResourceSpecificationKind;Application::ApplicationManifestKind" />
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>
          (and 
            (eq (evaluated "Application" "ApplicationManifestKind") "CustomManifest")
            (eq (evaluated "Application" "ResourceSpecificationKind") "IconAndManifest"))
        </NameValuePair.Value>
      </NameValuePair>
    </StringProperty.Metadata>
  </StringProperty>

  <StringProperty Name="Win32Resource"
                  DisplayName="Resource file"
                  Description="Specifies a resource file for the project."
                  HelpUrl="https://go.microsoft.com/fwlink/?linkid=2147078"
                  Category="Resources"
                  Subtype="file">
    <StringProperty.Metadata>
      <NameValuePair Name="DependsOn" Value="Application::ResourceSpecificationKind" />
      <NameValuePair Name="VisibilityCondition">
        <NameValuePair.Value>(eq (evaluated "Application" "ResourceSpecificationKind") "ResourceFile")</NameValuePair.Value>
      </NameValuePair>
    </StringProperty.Metadata>
  </StringProperty>
</Rule>
