Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions src/Cli/Microsoft.DotNet.FileBasedPrograms/MSBuildUtilities.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)**\*.cs" />
<!-- Shared with the SDK MSBuild build tasks; kept in src\Common to avoid duplication (https://github.com/dotnet/sdk/issues/51487). -->
<Compile Include="$(MSBuildThisFileDirectory)..\..\Common\MSBuildUtilities.cs" Link="MSBuildUtilities.cs" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)FileBasedProgramsResources.resx" GenerateSource="true" Namespace="Microsoft.DotNet.FileBasedPrograms">
<SubType>Designer</SubType>
</EmbeddedResource>
Expand Down
16 changes: 16 additions & 0 deletions src/Common/MSBuildUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// This file is shared between the SDK MSBuild build tasks and the Microsoft.DotNet.FileBasedPrograms source
// package (which is also consumed by Roslyn and the dotnet CLI) to avoid a duplicate copy. See
// https://github.com/dotnet/sdk/issues/51487. The build-tasks projects that link this file define
// MSBUILD_BUILD_TASKS to select the Microsoft.DotNet.Cli namespace; every other consumer (the source
// package, its external consumers, and ProjectTools) gets the Microsoft.DotNet.FileBasedPrograms form,
// which matches the file as it originally shipped. The build tasks enable nullable and provide System via
// ImplicitUsings, so emitting the directive and using there would be flagged as redundant (IDE0240/IDE0005).
#if !MSBUILD_BUILD_TASKS
#nullable enable
using System;
#endif

#if MSBUILD_BUILD_TASKS
namespace Microsoft.DotNet.Cli
#else
namespace Microsoft.DotNet.FileBasedPrograms
#endif
{
/// <summary>
/// Internal utilities copied from microsoft/MSBuild repo.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<PropertyGroup>
<OutputPath>$(BaseOutputPath)</OutputPath>
<DefineConstants>$(DefineConstants);EXTENSIONS</DefineConstants>
<DefineConstants>$(DefineConstants);EXTENSIONS;MSBUILD_BUILD_TASKS</DefineConstants>
<IsPackable>true</IsPackable>
<PackageLayoutOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\$(PackageId)\</PackageLayoutOutputPath>
</PropertyGroup>
Expand All @@ -53,6 +53,8 @@
<ItemGroup>
<Compile Include="**\*.cs" />
<Compile Include="..\Common\**\*.cs" LinkBase="Common" />
<!-- MSBuildUtilities.cs is shared with the Microsoft.DotNet.FileBasedPrograms source package; MSBUILD_BUILD_TASKS
(defined above) selects the Microsoft.DotNet.Cli namespace for this build-tasks copy. See https://github.com/dotnet/sdk/issues/51487. -->
<Compile Include="$(RepoRoot)src\Common\MSBuildUtilities.cs" LinkBase="Common" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
<PackageReference Update="NuGet.ProjectModel" ExcludeAssets="Runtime" />
</ItemGroup>

<!-- MSBuildUtilities.cs is shared with the Microsoft.DotNet.FileBasedPrograms source package; this symbol
selects the Microsoft.DotNet.Cli namespace for the build-tasks copy. See https://github.com/dotnet/sdk/issues/51487. -->
<PropertyGroup>
<DefineConstants>$(DefineConstants);MSBUILD_BUILD_TASKS</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="**\*.cs" />
<Compile Include="..\Common\**\*.cs" LinkBase="Common" />
Expand Down
Loading