<!--
***********************************************************************************************
Microsoft.NET.Sdk.Web.ProjectSystem.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets"
          Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets') AND '$(EnableTypeScriptNuGetTarget)' != 'true'"/>

  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.DotNetCore.targets"
          Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.DotNetCore.targets') AND '$(EnableTypeScriptNuGetTarget)' != 'true'"/>

  <PropertyGroup>
    <RunWorkingDirectory Condition=" '$(RunWorkingDirectory)' == '' and '$(EnableDefaultRunWorkingDirectory)' != 'false' ">$(MSBuildProjectDirectory)</RunWorkingDirectory>
    <MSBuildWebTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed.Web\</MSBuildWebTargetsPath>
    <AspNetCoreHostingModel Condition="'$(AspNetCoreHostingModel)' == '' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(_TargetFrameworkVersionWithoutV)' != '' And '$(_TargetFrameworkVersionWithoutV)' &gt;= '3.0' ">inprocess</AspNetCoreHostingModel>
    <AspNetCoreModuleName Condition="'$(AspNetCoreModuleName)' == '' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(_TargetFrameworkVersionWithoutV)' != '' And '$(_TargetFrameworkVersionWithoutV)' &gt;= '3.0' ">AspNetCoreModuleV2</AspNetCoreModuleName>
  </PropertyGroup>

  <ItemGroup>
    <ProjectCapability Include="DotNetCoreWeb" />
    <ProjectCapability Include="AspNetCore" />
    <ProjectCapability Include="Web" />
    <ProjectCapability Include="AppServicePublish" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(_TargetFrameworkVersionWithoutV)' != '' And '$(_TargetFrameworkVersionWithoutV)' &gt;= '3.0' ">
    <ProjectCapability Include="AspNetCoreInProcessHosting" />
  </ItemGroup>

  <PropertyGroup>
    <!--
      ASP.NET 5.0+ explicitly disables this functionality by default, requiring the app author
      to opt-in to re-enabling the feature. The way to opt back in is to specify the below
      element with the value "true". This functionality is disabled across most project types
      by default in .NET 8; however, we need to keep the line below since it's not conditioned
      on a version check like the normal SDK targets logic is.
    -->
    <EnableUnsafeBinaryFormatterSerialization Condition="'$(EnableUnsafeBinaryFormatterSerialization)' == ''">false</EnableUnsafeBinaryFormatterSerialization>
  </PropertyGroup>

  <!-- Default settings for aot'd apps. -->
  <PropertyGroup Condition="'$(PublishAot)' == 'true'">
    <!-- Enable System.GC.DynamicAdaptationMode by default for aot'd apps to get a GC that dynamically adapts to the application's memory use. -->
    <GarbageCollectionAdaptationMode Condition="'$(GarbageCollectionAdaptationMode)' == '' And '$(ServerGarbageCollection)' == 'true'">1</GarbageCollectionAdaptationMode>
  </PropertyGroup>

  <!-- Default settings for trimmed apps. -->
  <PropertyGroup Condition="'$(PublishTrimmed)' == 'true' Or '$(PublishAot)' == 'true'">
    <!-- Enable the built-in source generators. -->
    <EnableRequestDelegateGenerator Condition="'$(EnableRequestDelegateGenerator)' == ''">true</EnableRequestDelegateGenerator>
    <EnableConfigurationBindingGenerator Condition="'$(EnableConfigurationBindingGenerator)' == ''">true</EnableConfigurationBindingGenerator>

    <!-- Default feature switch values for trimmed apps. -->
    <SignalRCustomAwaitableSupport Condition="'$(SignalRCustomAwaitableSupport)' == ''">false</SignalRCustomAwaitableSupport>
    <MvcEnhancedModelMetadataSupport Condition="'$(MvcEnhancedModelMetadataSupport)' == ''">false</MvcEnhancedModelMetadataSupport>
  </PropertyGroup>

  <PropertyGroup>
    <!-- Set the namespaces emitted by the RequestDelegateGenerator for interception when applicable. -->
    <InterceptorsPreviewNamespaces Condition="'$(EnableRequestDelegateGenerator)' == 'true'">$(InterceptorsPreviewNamespaces);Microsoft.AspNetCore.Http.Generated</InterceptorsPreviewNamespaces>
    <!-- Set the namespaces emitted by the ConfigurationBindingGenerator for interception when applicable. -->
    <InterceptorsPreviewNamespaces Condition="'$(EnableConfigurationBindingGenerator)' == 'true'">$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>
  </PropertyGroup>

  <!--
    Newer versions of Visual Studio ship the designtime related properties in a targets file and all future design time only elements should be added there. If that file does not
    exist, it falls back to the default set of values defined here.
  -->
    <Import Project="$(MSBuildWebTargetsPath)Microsoft.Web.Designtime.targets" Condition="Exists('$(MSBuildWebTargetsPath)Microsoft.Web.Designtime.targets')" />

    <Choose>
      <When Condition="!Exists('$(MSBuildWebTargetsPath)Microsoft.Web.Designtime.targets')" >
        <PropertyGroup>
          <ActualLangName Condition="Exists('$(MSBuildWebTargetsPath)$(LangName)')">$(LangName)</ActualLangName>
          <ActualLangName Condition="'$(ActualLangName)' == ''">en-us</ActualLangName>
        </PropertyGroup>

        <!-- Web project capabilities that enables web features in VS for .NET Core projects -->
        <ItemGroup>
          <ProjectCapability Include="SupportHierarchyContextSvc" />
          <ProjectCapability Include="DynamicDependentFile" />
          <ProjectCapability Include="DynamicFileNesting" />

          <!--
            Enables UI for managing secret values when Microsoft.Extensions.Configuration.UserSecrets 1.x is referenced.
            Newer versions of this package include a MSBuild file to set this ProjectCapability, but older versions did not include this.
            See https://github.com/aspnet/Configuration/blob/9135af4b4e95c080ca4a9f0e91ba5a0b8a561c96/src/Microsoft.Extensions.Configuration.UserSecrets/build/netstandard1.0/Microsoft.Extensions.Configuration.UserSecrets.targets#L10
          -->
          <ProjectCapability Include="LocalUserSecrets" Condition=" '$(GenerateUserSecretsAttribute)' == 'true' " />

        </ItemGroup>

        <!-- Web specific properties -->
        <ItemGroup>
          <PropertyPageSchema Include="$(MSBuildWebTargetsPath)$(ActualLangName)\GeneralBrowseObject.xaml"
                              Condition="Exists('$(MSBuildWebTargetsPath)$(ActualLangName)\GeneralBrowseObject.xaml')">
            <Context>BrowseObject</Context>
          </PropertyPageSchema>
        </ItemGroup>
    </When>
  </Choose>

</Project>
