File: Microsoft.NET.Build.Containers.csproj
Web Access
Project: ..\..\..\src\Containers\Microsoft.NET.Build.Containers\Microsoft.NET.Build.Containers.csproj (Microsoft.NET.Build.Containers)
<Project Sdk="Microsoft.NET.Sdk">
 
  <PropertyGroup>
    <TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
    <ImplicitUsings Condition="'$(TargetFramework)' != 'net472'">enable</ImplicitUsings>
 
    <TargetsForTfmSpecificBuildOutput>
      $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage
    </TargetsForTfmSpecificBuildOutput>
 
    <!-- Tell the SDK to generate a deps.json file to be used by .NET SDK MSBuild -->
    <GenerateDependencyFile Condition=" '$(TargetFramework)' != 'net472'">true</GenerateDependencyFile>
 
    <!-- Allow the packaging project to use the name `Microsoft.NET.Build.Containers` for the nuget package -->
    <Packageid>.</Packageid>
 
    <!-- While in prerelease, ship the symbols to everyone all the time. -->
    <DebugType>embedded</DebugType>
    <NoWarn>$(NoWarn);CS8002</NoWarn>
    <StrongNameKeyId>MicrosoftShared</StrongNameKeyId>
    <SignAssembly>true</SignAssembly>
 
    <!-- Avoid https://github.com/dotnet/arcade/issues/9305 -->
    <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
  </PropertyGroup>
 
  <ItemGroup>
    <ProjectReference Include="..\..\Cli\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj"
                      Condition="'$(TargetFramework)' != 'net472'"
                      GlobalPropertiesToRemove="PublishDir">
      <!-- This is referenced by the core CLI as well so it doesn't need to be redistributed
           in the containers task folder. -->
      <IncludeAssets>build</IncludeAssets>
      <Private>false</Private>
    </ProjectReference>
    <ProjectReference Include="..\..\Microsoft.Extensions.Logging.MSBuild\Microsoft.Extensions.Logging.MSBuild.csproj" Condition="'$(TargetFramework)' != 'net472'" />
  </ItemGroup>
 
  <ItemGroup>
    <PackageReference Include="Microsoft.Build.Utilities.Core" PrivateAssets="all" ExcludeAssets="runtime" />
    <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Condition=" '$(DotNetBuildSourceOnly)' != 'true' ">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Nuget.Packaging">
      <!-- In the SDK, NuGet is already available in the MSBuild/SDK directory -->
      <ExcludeAssets Condition="'$(TargetFramework)' != 'net472'">runtime</ExcludeAssets>
    </PackageReference>
    <PackageReference Include="System.Text.Json" ExcludeAssets="runtime" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
      <!-- For the net472 flavor, lock back to a System.Text.Json equal to or older than MSBuild will provide
           so it doesn't have to be redistributed. -->
      <VersionOverride Condition="'$(TargetFramework)' == 'net472'">$(SystemTextJsonToolsetPackageVersion)</VersionOverride>
    </PackageReference>
  </ItemGroup>
 
  <ItemGroup Condition="'$(TargetFramework)' != 'net472'">
    <PackageReference Include="Valleysoft.DockerCredsProvider" />
 
    <!-- References that are also carried in the SDK itself so don't need to be redistributed -->
    <PackageReference Include="Microsoft.Extensions.Logging" ExcludeAssets="runtime" />
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" ExcludeAssets="runtime" />
  </ItemGroup>
 
  <!-- net472 builds manually import files to compile -->
  <ItemGroup Condition="'$(TargetFramework)' == 'net472'">
    <Compile Remove="**/*.*" />
    <Compile Include="ReferenceParser.cs" />
    <Compile Include="KnownStrings.cs" />
    <Compile Include="DockerLoadException.cs" />
    <Compile Include="Registry/RegistryConstants.cs" />
    <Compile Include="Tasks/ParseContainerProperties.cs" />
    <Compile Include="Tasks/CreateNewImage.Interface.cs" />
    <Compile Include="Tasks/CreateNewImageToolTask.cs" />
    <Compile Include="Tasks/ComputeDotnetBaseImageAndTag.cs" />
    <Compile Include="ContainerHelpers.cs" />
    <Compile Include="net472Definitions.cs" />
    <Compile Include="VSHostObject.cs" />
    <Compile Include="Port.cs" />
    <Compile Include="Resources\Resource.cs" />
    <Compile Include="Resources\Strings.Designer.cs" />
    <Compile Include="Globals.cs" />
  </ItemGroup>
 
  <!-- core remove files specific to net472 workarounds -->
  <ItemGroup Condition="'$(TargetFramework)' != 'net472'">
    <Compile Remove="Tasks/CreateNewImageToolTask.cs" />
    <Compile Remove="net472Definitions.cs" />
    <Compile Remove="VSHostObject.cs" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="Resources\Strings.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Strings.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Update="Resources\Strings.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Strings.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
 
  <ItemGroup>
    <AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
    <AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
  </ItemGroup>
 
  <!-- This target adds all of our PackageReference and ProjectReference's runtime assets to our package output. -->
  <Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
    <ItemGroup>
      <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths)" TargetPath="%(ReferenceCopyLocalPaths.DestinationSubPath)" />
    </ItemGroup>
  </Target>
 
  <!-- This target adds the generated deps.json file to our package output -->
  <Target Name="AddBuildDependencyFileToBuiltProjectOutputGroupOutput" BeforeTargets="BuiltProjectOutputGroup" Condition="'$(GenerateDependencyFile)' == 'true'">
    <ItemGroup>
      <BuiltProjectOutputGroupOutput Include="$(ProjectDepsFilePath)" TargetPath="$(ProjectDepsFileName)" FinalOutputPath="$(ProjectDepsFilePath)" />
    </ItemGroup>
  </Target>
 
  <!-- Copy to *.csproj for using in sanity checks integration tests. -->
  <Target Name="CopyCsprojToTestExecutionDirectory" AfterTargets="Build">
    <Copy SourceFiles="$(MSBuildThisFileFullPath)" DestinationFiles="$(TestLayoutDir)Container\ProjectFiles\$(MSBuildThisFileName).csproj" SkipUnchangedFiles="true" />
  </Target>
 
</Project>