Skip to content

Commit

Permalink
Remove dead code from WCF repository & simplify msbuild logic (#5222)
Browse files Browse the repository at this point in the history
* Remove dead code from wcf repository

- .gitmirrorall, DotnetCLIVersion.txt, _._, harvest.targets,
  Configurations.props, archgroups.props, configurationgroups.props,
  DefaultGenApiDocIds.txt, LicenseHeader.txt, osgroups.props,
  properties.props, TargetFramework.props, Configurations.props and
  targetgroups.props were all used by dotnet/buildtools tooling that
  has been removed more than five years ago from this repository.
- uwp.targets, Publishing.props aren't used anymore (Publishing.props
  isn't necessary anymore as Arcade defaults to version 3).
- build.ps1/build.sh code was copied from runtime and doesn't apply to
  this repository.
- project files: IsBuilding, IsHarvesting are dead properties.
  PackageReference to Microsoft.NETFramework.ReferenceAssemblies is
  added automatically by the SDK. Use EnableDefaultItems=false instead
  of removing Compile items and resources. Remove outdated comment.

* Simplify msbuild logic

1. Remove dead properties from TestProperties.props and move the
   remaining ones directly into Directory.Build.props
2. Fix dotnet-svcutil-lib.csproj condition which was conditioning on the
   ConfigurationGroup property which wasn't set anymore.
3. Remove dead properties (which now are either the default or were
   removed) from Versions.props. Move one version property from
   Directory.Build.props into Versions.props
4. Remove the unnecessary "ToolsVersion="14.0" xmlns="..."" tag.
   MSBuild/VS doesn't require that anymore.
5. Drastically simplify logic in Versions.props (sync with what we have
   in runtime) by removing the now unnecessary targets. Move what
   remains directly into Directory.Build.*.
6. Remove dead code from ReferenceAssemblies.props and move the
   remainder into Directory.Build.props.

* Add -vs switch back

* Update CertificateGenerator.csproj
  • Loading branch information
ViktorHofer authored Aug 4, 2023
1 parent 2fbe1bb commit 7cd6512
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 794 deletions.
1 change: 0 additions & 1 deletion .gitmirrorall

This file was deleted.

45 changes: 27 additions & 18 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,49 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<ImportNetSdkFromRepoToolset>false</ImportNetSdkFromRepoToolset>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng\ReferenceAssemblies.props" />
<Import Project="eng\Versioning.props"/>
<Import Project="eng\TestProperties.props"/>
<Import Project="eng\TargetFramework.props" />

<!-- Packaging props -->
<PropertyGroup Condition="'$(CopyrightNetFoundation)' != ''">
<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Ship_SvcUtilXmlSerPackages Condition="'$(Ship_SvcUtilXmlSerPackages)'==''">false</Ship_SvcUtilXmlSerPackages>
<Ship_SvcUtilPackages Condition="'$(Ship_SvcUtilPackages)'==''">false</Ship_SvcUtilPackages>
<Ship_WcfPackages Condition="'$(Ship_WcfPackages)'==''">true</Ship_WcfPackages>
</PropertyGroup>

<!-- Include license and third party files to packages -->
<ItemGroup>
<Content Include="$(RepoRoot)THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="\" />
<Content Include="$(RepoRoot)LICENSE.TXT" Pack="true" PackagePath="\" />
</ItemGroup>

<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(IsPartialFacadeAssembly)'=='' AND ($(MSBuildProjectName.EndsWith('.Facade')))">true</IsPartialFacadeAssembly>
<IsReferenceAssembly Condition="'$(IsReferenceAssembly)'=='' AND ($(MSBuildProjectName.EndsWith('.Ref')))">true</IsReferenceAssembly>
</PropertyGroup>

<PropertyGroup>
<MicrosoftIdentityModelProtocolsWsTrustPackageVersion>6.8.0</MicrosoftIdentityModelProtocolsWsTrustPackageVersion>
<WcfPrivateServiceModelProj>$(RepoRoot)src\System.Private.ServiceModel\src\System.Private.ServiceModel.csproj</WcfPrivateServiceModelProj>
<SvcUtilCoreProj>$(RepoRoot)src\svcutilcore\src\dotnet-svcutil.xmlserializer.csproj</SvcUtilCoreProj>
<WcfUnitTestCommonProj>$(RepoRoot)src\System.Private.ServiceModel\tests\Common\Unit\UnitTests.Common.csproj</WcfUnitTestCommonProj>
<WcfScenarioTestCommonProj>$(RepoRoot)src\System.Private.ServiceModel\tests\Common\Scenarios\ScenarioTests.Common.Tests.csproj</WcfScenarioTestCommonProj>
<WcfInfrastructureCommonProj>$(RepoRoot)src\System.Private.ServiceModel\tests\Common\Infrastructure\Infrastructure.Common.csproj</WcfInfrastructureCommonProj>
</PropertyGroup>

<!-- All reference assemblies should have a ReferenceAssemblyAttribute and the 0x70 flag which prevents them from loading. -->
<ItemGroup Condition="'$(IsReferenceAssembly)' == 'true'">
<AssemblyAttribute Include="System.Runtime.CompilerServices.ReferenceAssemblyAttribute" />
<AssemblyAttribute Include="System.Reflection.AssemblyFlags">
<_Parameter1>(System.Reflection.AssemblyNameFlags)0x70</_Parameter1>
<_Parameter1_IsLiteral>true</_Parameter1_IsLiteral>
</AssemblyAttribute>
</ItemGroup>

<PropertyGroup>
<ScenarioTestTargetFrameworks>net6.0;net7.0</ScenarioTestTargetFrameworks>
<UnitTestTargetFrameworks>net6.0;net7.0</UnitTestTargetFrameworks>
<!-- This is the target framework version of the built tests picked up to send to Helix -->
<UnitTestTargetFrameworks>net6.0;net7.0</UnitTestTargetFrameworks>
<!-- This is the target framework version of the built tests picked up to send to Helix -->
<XUnitPublishTargetFramework>net6.0</XUnitPublishTargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<!-- TODO: Remove this condition when VSTest is used in CI. -->
<EnableRunSettingsSupport Condition="'$(ContinuousIntegrationBuild)' != 'true'">true</EnableRunSettingsSupport>
</PropertyGroup>

<ItemGroup>
<!-- Include license and third party files to packages -->
<Content Include="$(RepoRoot)THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="\" />
<Content Include="$(RepoRoot)LICENSE.TXT" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<!-- Microsoft.NET.Test.Sdk package defaults to restore the minimum supported version for its dependency Newtonsoft.Json, here force test project to reference higher version for security reason. -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

</Project>
46 changes: 44 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng\FacadeAssemblies.targets" Condition="'$(IsPartialFacadeAssembly)' == 'true'" />
<Import Project="eng\harvest.targets" Condition="'$(HarvestFromPackage)' == 'true'" />
<Import Project="eng\uwp.targets" />
<Import Project="eng\testing\runsettings.targets" Condition="'$(EnableRunSettingsSupport)' == 'true'" />

<PropertyGroup>
<!-- Disable some standard properties for building our projects -->
<GenerateTargetFrameworkAttribute>true</GenerateTargetFrameworkAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<!-- [todo:arcade] This attribute exists in our previously shipped S.P.SM assembly but not in all the Facade assemblies. For now removing accross all assemblies. -->
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>

<PropertyGroup>
<!-- wcf has always added a description set to assembly name so include that here -->
<Description Condition="'$(Description)' == ''">$(AssemblyName)</Description>

<!-- SDK sets product to assembly but we want it to be our product name -->
<Product>Microsoft%AE .NET Core</Product>

<!-- Use the .NET Core product branding version for informational version description -->
<!-- [todo:arcade] Currently in local builds this is producing a weird version "3.0.0-ci.19157.1" need to verify what this looks like in an official build. -->
<InformationalVersion>$(ProductVersion)</InformationalVersion>
<InformationalVersion Condition="'$(VersionSuffix)' != ''">$(InformationalVersion)-$(VersionSuffix)</InformationalVersion>
</PropertyGroup>

<!-- [todo:arcade] Make sure all test projects set IsTestProject to true -->
<ItemGroup Condition="'$(IsTestProject)' != 'true'" >
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>Serviceable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadata">
<_Parameter1>PreferInbox</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyDefaultAliasAttribute">
<_Parameter1>$(AssemblyName)</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="CLSCompliantAttribute" Condition="'$(CLSCompliant)' == 'true'">
<_Parameter1>true</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion DotnetCLIVersion.txt

This file was deleted.

15 changes: 0 additions & 15 deletions eng/BlockReflectionAttribute.cs

This file was deleted.

2 changes: 1 addition & 1 deletion eng/FacadeAssemblies.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>

<PropertyGroup>
<!--Don't produce or publish symbols for Facade assemblies.-->
Expand Down
6 changes: 0 additions & 6 deletions eng/Publishing.props

This file was deleted.

18 changes: 0 additions & 18 deletions eng/ReferenceAssemblies.props

This file was deleted.

64 changes: 0 additions & 64 deletions eng/TargetFramework.props

This file was deleted.

17 changes: 0 additions & 17 deletions eng/TestProperties.props

This file was deleted.

Loading

0 comments on commit 7cd6512

Please sign in to comment.