Skip to content

Instantly share code, notes, and snippets.

@SingleAccretion
Last active December 26, 2020 20:33
Show Gist options
  • Select an option

  • Save SingleAccretion/86b7b26c541c8109667c9537c7cef845 to your computer and use it in GitHub Desktop.

Select an option

Save SingleAccretion/86b7b26c541c8109667c9537c7cef845 to your computer and use it in GitHub Desktop.
Analysis preparation notes

Done

General

  • Run the analyzer with the dotnet host so that it is long path aware.

dotnet/runtime

  • Build the CLR in debug and release.
  • Build libs in debug and release, both src and ref.
  • Add TargetRefPath MSBuild property to eng\BeforeTargetFrameworkInference.targets.
<TargetRefPath Condition="'$(IsTestProject)' == 'false' AND '$(OutputType)' == 'Library'">$([MSBuild]::NormalizePath('$(BaseOutputPath)', 'ref', '$(TargetFramework)-$(Configuration)', '$(MSBuildProjectName).dll'))</TargetRefPath>
<TargetRefPath Condition="'$(TargetRefPath)' != '' AND '$(IsReferenceAssembly)' == 'true'">$([MSBuild]::NormalizePath('$(BaseOutputPath)', '$(TargetFramework)-$(Configuration)', '$(MSBuildProjectName).dll'))</TargetRefPath>
  • Runtime projects can have many possible TargetRefPaths because the artifacts are published to different directories. Since some projects might reference different binaries for the same project, and MSBuild might prefer refs that are not on the path specified via TargetRefPath, renaming the following assemblies for the shared framework (artifacts\bin\ref\net5.0, artifacts\bin\ref\microsoft.netcore.app\Release and artifacts\bin\ref\microsoft.netcore.app\Debug) works to effectively "unify" the ref paths, so that MSBuild always chooses those published under the default output folder:

    Assemblies to rename
    • System.Runtime
    • System.Runtime.Extensions
    • System.Runtime.InteropServices
    • System.Runtime.CompilerServices.Unsafe
    • System.Reflection.MetadataLoadContext
    • System.ComponentModel
    • System.ComponentModel.Composition
    • System.ComponentModel.Primitives
    • System.ComponentModel.TypeConverter
    • System.Collections
    • System.Collections.NonGeneric
    • System.Data.Odbc
    • System.Drawing.Common
    • System.DirectoryServices
    • System.DirectoryServices.Protocols
    • System.DirectoryServices.AccountManagement
    • System.ObjectModel
    • System.Security.Permissions
    • System.Security.AccessControl
    • System.Security.Principal.Windows
    • System.Security.Cryptography.OpenSsl
    • System.Security.Cryptography.Cng
    • System.Security.Cryptography.Pkcs
    • System.IO.FileSystem.AccessControl
    • System.IO.Pipes.AccessControl
    • System.IO.Pipes
    • System.IO.Pipelines
    • System.Formats.Asn1
    • System.Formats.Cbor
    • System.Text.Json
    • System.Windows.Extensions
    • System.ServiceModel.Syndication
    • System.ServiceProcess.ServiceController
    • System.Management
    • System.Memory
    • System.Net.WebSockets.WebSocketProtocol
    • System.Net.Connections
    • System.Diagnostics.EventLog
    • System.Diagnostics.DiagnosticSource
    • System.Diagnostics.PerformanceCounter
    • Microsoft.Extensions.Primitives
    • Microsoft.Extensions.DependencyInjection
    • Microsoft.Extensions.Logging.Console
    • Microsoft.Extensions.Logging.EventSource
    • Microsoft.Extensions.Options
    • Microsoft.Win32.SystemEvents
    • Microsoft.Win32.Registry
    • System.Utf8String.Experimental
  • Be aware that renaming System.Runtime.dll will break the build of System.Runtime.CompilerServices.Unsafe. Do something about it.

  • Be aware that renaming some of these assemblies will break the build of projects under src\tests.

  • Add empty Compile, CoreCompile and PrepareResourceNames targets to:

    • X509Certificates.csproj
    • System.Xml.RW.XmlReader.ReadContentAs.Tests.csproj
  • Change <TargetFrameworks>$(NetCoreAppCurrent);<TargetFrameworks> to <TargetFramework>$(NetCoreAppCurrent)<TargetFramework> in System.Xml.RW.XmlReader.ReadContentAs.Tests.csproj.

  • Change <TargetFrameworks>$(NetCoreAppCurrent);net461</TargetFrameworks> to <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> in Microsoft.Extensions.Hosting.Functional.Tests.csproj.

  • Copy System.SR.cs from net5.0-Debug to (manually created) Debug in artifacts\obj\System.Security.Cryptography.X509Certificates.

  • nuget restore CoreFxNetCloudService.sln

  • Manually build Microsoft.Extensions.HostFactoryResolver.Tests.csproj.

  • Restore test assets:

runtime> cd src\tests\Common
runtime\src\tests\Common> dotnet restore test_dependencies
runtime\src\tests\Common> dotnet restore test_dependencies_fs
  • Build all IL test projects under:
runtime\src\tests> ls *.ilproj -r | % -Parallel { dotnet build $_.FullName }
  • Build all C# test projects:
    • runtime\srs\tests> ./build skipnative.
    • skipnative is needed to avoid MAX_PATH issues with FileTracker.
  • Replace <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" /> with <Import Project="..\..\..\..\Directory.Build.props" /> in unofficial_dotnet\JitBench.csproj (this part of the build appears to have bitrotten).
  • Add empty Compile and CoreCompile targets to coreclr\tests\scripts\scripts.csproj.
  • Comment out the empty Compile and CoreCompile targets in tests\Common\runonly.targets and tests\Common\nobuild.targets.
  • Duplicate WindowsEventLog.cs into WindowsEventLog_TargetUnix.cs and WindowsEventLog_TargetWindows in tests\baseservices\exceptions\WindowsEventLog.
  • Comment out the ruleset reference in coreclr\src\tools\GCLogParser\parse-hb-log.csproj.
  • Manually build mono\wasm\debugger\BrowserDebugHost\BrowserDebugHost.csproj.

dotnet/sdk

  • Build the repository: .\build.
  • Exclude src\Assets from analysis.
  • Add empty Compile, CoreCompile and PrepareResourceNames to Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj, replace TargetFrameworks with <TargetFramework>net5.0</TargetFramework>.

dotnet/efcore

  • Build the repository: .\build.
  • Comment out the empty Compile target in Microsoft.Data.Sqlite.csproj, EFCore.Sqlite.csproj and EFCore.Tools.csproj so that referenced project's metadata is picked up.

dotnet/msbuild

  • Build the repository: .\build.

  • Convert Deprecated\Engine.UnitTests\Microsoft.Build.Engine.UnitTests.csproj and Deprecated\Conversion.UnitTests\XMakeConversionUnitTests.csproj to SDK-style projects and update InternalsVisibleTo declarations in Deprecated\Engine\AssemblyInfo.cs and Deprecated\Conversion\AssemblyInfo.cs to use the test key from src\Directory.Build.targets.

    • Converted Microsoft.Build.Engine.UnitTests.csproj
      <!-- #AnalyzingDotnet - this file has been completely rewritten -->
      <Project Sdk="Microsoft.NET.Sdk">
      
        <PropertyGroup>
          <TargetFramework>$(FullFrameworkTFM)</TargetFramework>
          <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
      	<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
          <IsUnitTestProject>true</IsUnitTestProject>	
          <OutputPath>$(SuiteBinPath)</OutputPath>
          <OutputType>library</OutputType>
          <AssemblyName>Microsoft.Build.Engine.Unittest</AssemblyName>
          <Nonshipping>true</Nonshipping>
          <BuildArchitecturesAllowed>$(BuildArchitecturesAllowed);amd64;arm</BuildArchitecturesAllowed>
        </PropertyGroup>
        <!-- IDE specific Information -->
        <PropertyGroup>
          <!-- NUnit 2.0 syntax is flagged as obsolete -->
          <NoWarn>$(NoWarn);0618</NoWarn>
          <ProjectGuid>{91781F04-64B3-4E65-882D-C8613484F850}</ProjectGuid>
        </PropertyGroup>
        <ItemGroup>
          <!-- #AnalyzingDotnet - original content -->
          <Compile Include="..\Engine\Shared\UnitTests\Assertion.cs" />
      	
          <Compile Include="..\Engine\Shared\UnitTests\EscapingUtilities_Tests.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\ErrorUtilities_Tests.cs" />
          <Compile Include="..\Engine\Shared\Unittests\FileUtilities_Tests.cs" />
          <Compile Include="..\Engine\Shared\Unittests\ObjectModelHelpers.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\MockEngine.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\MockLogger.cs" />
          <Compile Include="..\Engine\Shared\Unittests\ResourceUtilities_Tests.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\SolutionParser_Tests.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\StreamHelpers.cs" />
          <Compile Include="..\Engine\Shared\Unittests\TypeLoader_Tests.cs" />
          <Compile Include="..\Engine\Shared\UnitTests\XmakeAttributes_Tests.cs">
            <Link>XmakeAttributes_Tests.cs</Link>
          </Compile>
          <Compile Include="..\Engine\Shared\Unittests\XmlUtilities_Tests.cs" />
      
          <Compile Include="..\..\Shared\UnitTests\TestEnvironment.cs" />
      	<Compile Include="..\..\Shared\UnitTests\AssemblyResources.cs" />
      	
          <Compile Include="..\..\Shared\FileUtilities.cs" />
      	<Compile Include="..\..\Shared\TempFileUtilities.cs" />
      	<Compile Include="..\..\Shared\FileUtilitiesRegex.cs" />
      	<Compile Include="..\..\Shared\FileSystem\IFileSystem.cs" />
          <Compile Include="..\..\Shared\FileSystem\FileSystems.cs" />
          <Compile Include="..\..\Shared\FileSystem\MSBuildOnWindowsFileSystem.cs" />
          <Compile Include="..\..\Shared\FileSystem\ManagedFileSystem.cs" />
          <Compile Include="..\..\Shared\FileSystem\WindowsFileSystem.cs" />
          <Compile Include="..\..\Shared\FileSystem\WindowsNative.cs" />        
        	<Compile Include="..\..\Shared\FileSystem\NativeWin32Exception.cs" />
          <Compile Include="..\..\Shared\FileSystem\SafeFileHandle.cs" />
      	<Compile Include="..\..\Shared\Debugging\PrintLineDebugger.cs" />
      	<Compile Include="..\..\Shared\Debugging\PrintLineDebuggerWriters.cs" />
      	<Compile Include="..\..\Shared\BuildEnvironmentHelper.cs" />
      	<Compile Include="..\..\Shared\AssemblyUtilities.cs" />
          <Compile Include="..\..\Shared\ErrorUtilities.cs" />
          <Compile Include="..\..\Shared\EscapingUtilities.cs" />
          <Compile Include="..\..\Shared\ExceptionHandling.cs" />
          <Compile Include="..\..\Shared\InternalErrorException.cs" />
          <Compile Include="..\..\Shared\NativeMethodsShared.cs" />
          <Compile Include="..\..\Shared\IInternable.cs" />
          <Compile Include="..\..\Shared\WeakStringCache.cs" />
          <Compile Include="..\..\Shared\WeakStringCache.Concurrent.cs" />
          <Compile Include="..\..\Shared\OpportunisticIntern.cs" />
          <Compile Include="..\..\Shared\ResourceUtilities.cs" />
          <Compile Include="..\..\Shared\StringBuilderCache.cs" />
      	<Compile Include="..\..\Shared\ReuseableStringBuilder.cs" />
          <Compile Include="..\..\Shared\VisualStudioLocationHelper.cs" />
      	<Compile Include="..\..\Shared\Traits.cs" />
      	<Compile Include="..\..\Shared\ChangeWaves.cs" />
      	
          <Compile Include="BatchingEngine_Tests.cs" />
          <Compile Include="BuildItemDefinitionGroupXml_Tests.cs" />
          <Compile Include="BuildItemGroupProxy_Tests.cs" />
          <Compile Include="BuildItemGroup_Tests.cs" />
          <Compile Include="BuildItemGroupChildXml_Tests.cs" />
          <Compile Include="BuildPropertyGroupProxy_Tests.cs" />
          <Compile Include="BuildRequest_Tests.cs" />
          <Compile Include="BuildResult_Tests.cs" />
          <Compile Include="BuildTask_Tests.cs" />
          <Compile Include="CacheEntry_Tests.cs" />
          <Compile Include="CacheManager_Tests.cs" />
          <Compile Include="CacheScope_Tests.cs" />
          <Compile Include="Choose_Tests.cs" />
          <Compile Include="BuildItem_Tests.cs" />
          <Compile Include="ConfigureableForwardingLogger_Tests.cs" />
          <Compile Include="ConsoleLogger_Tests.cs" />
          <Compile Include="CopyOnWriteHashtable_Tests.cs" />
          <Compile Include="DualQueue_Tests.cs" />
          <Compile Include="enginehelpers.cs" />
          <Compile Include="EngineLoggingServices_Tests.cs" />
          <Compile Include="EngineProxy_Tests.cs" />
          <Compile Include="Engine_Tests.cs" />
          <Compile Include="EscapingInProjects_Tests.cs" />
          <Compile Include="EventArgsFormatting_Tests.cs" />
          <Compile Include="Expander_Tests.cs" />
          <Compile Include="ExpressionShredder_Tests.cs" />
          <Compile Include="ExpressionTree_Tests.cs" />
          <Compile Include="FileLogger_Tests.cs" />
          <Compile Include="GroupingCollection_Tests.cs" />
          <Compile Include="HashTableUtility_Tests.cs" />
          <Compile Include="ImportCollection_Tests.cs" />
          <Compile Include="IntrinsicTask_Tests.cs" />
          <Compile Include="InvalidProjectFileException_Tests.cs" />
          <Compile Include="ItemBucket_Tests.cs" />
          <Compile Include="ItemDefinitionLibrary_Tests.cs" />
          <Compile Include="Item_Tests.cs" />
          <Compile Include="ItemExpander_Tests.cs" />
          <Compile Include="LocalNode_Tests.cs" />
          <Compile Include="LogFormatter_Tests.cs" />
          <Compile Include="LoggerDescription_Tests.cs" />
          <Compile Include="LoggerException_Tests.cs" />
          <Compile Include="Lookup_Tests.cs" />
          <Compile Include="MockNode.cs" />
          <Compile Include="MockProjectStartedLogger.cs" />
          <Compile Include="MockTask.cs" />
          <Compile Include="ProjectIdLogger.cs" />
          <Compile Include="TargetInProgressState_Tests.cs" />
          <Compile Include="ToolsetConfigurationReader_Tests.cs" />
          <Compile Include="NodeLoggingEventTests.cs" />
          <Compile Include="NodeManager_Tests.cs" />
          <Compile Include="NodeRequestMapping_Tests.cs" />
          <Compile Include="NodeStatus_Tests.cs" />
          <Compile Include="TaskWorkerThread_Tests.cs" />
          <Compile Include="OnError_Tests.cs" />
          <Compile Include="Parser_Tests.cs" />
          <Compile Include="Project_Tests.cs" />
          <Compile Include="ProjectManager_Tests.cs" />
          <Compile Include="projectschemavalidationhandler_tests.cs" />
          <Compile Include="Property_Tests.cs" />
          <Compile Include="PropertyGroup_Tests.cs" />
          <Compile Include="Scanner_Tests.cs" />
          <Compile Include="SharedMemory_Test.cs" />
          <Compile Include="SolutionWrapperProject_Tests.cs" />
          <Compile Include="TargetCollection_Tests.cs" />
          <Compile Include="TargetDependencyAnalyzer_Tests.cs" />
          <Compile Include="TaskEngine_Tests.cs" />
          <Compile Include="TaskExecutionContext_Tests.cs" />
          <Compile Include="TaskExecutionState_Test.cs" />
          <Compile Include="TaskItem_Tests.cs" />
          <Compile Include="TaskRegistry_Tests.cs" />
          <Compile Include="ToolsetConfigurationReaderTestHelper.cs" />
          <Compile Include="ToolsetRegistryReader_Tests.cs" />
          <Compile Include="ToolsetReader_Tests.cs" />
          <Compile Include="Toolset_Tests.cs" />
          <Compile Include="ToolsVersion_Tests.cs" />
          <Compile Include="UsingTaskCollection_Tests.cs" />
          <Compile Include="Utilities_Tests.cs" />
          <Compile Include="XmlSearcher_Tests.cs" />
          <Compile Include="XmlTestUtilities.cs" />
          <!-- Compatibility tests -->
          <Compile Include="Compatibility\BuildItemGroupCollection_Tests.cs" />
          <Compile Include="Compatibility\BuildItemGroup_Tests.cs" />
          <Compile Include="Compatibility\BuildItem_Tests.cs" />
          <Compile Include="Compatibility\AddNewImport_Tests.cs" />
          <Compile Include="Compatibility\Engine_Tests.cs" />
          <Compile Include="Compatibility\InvalidToolsetDefinitionException_Tests.cs" />
          <Compile Include="Compatibility\InvalidProjectfileException_Tests.cs" />
          <Compile Include="Compatibility\CompatibilityTestData.cs" />
          <Compile Include="Compatibility\BuildPropertyGroupCollection_Tests.cs" />
          <Compile Include="Compatibility\BuildPropertyGroup_Tests.cs" />
          <Compile Include="Compatibility\BuildProperty_Tests.cs" />
          <Compile Include="Compatibility\BuildTask_Tests.cs" />
          <Compile Include="Compatibility\CompatibilityTestHelpers.cs" />
          <Compile Include="Compatibility\ImportCollection_Tests.cs" />
          <Compile Include="Compatibility\Import_Tests.cs" />
          <Compile Include="Compatibility\Project_Tests.cs" />
          <Compile Include="Compatibility\TargetCollection_Tests.cs" />
          <Compile Include="Compatibility\Target_Tests.cs" />
          <Compile Include="Compatibility\ToolsetCollection_Tests.cs" />
          <Compile Include="Compatibility\Toolset_Tests.cs" />
          <Compile Include="Compatibility\UsingTaskCollection_Tests.cs" />
          <Compile Include="Compatibility\UsingTask_Tests.cs" />
          <Compile Include="Compatibility\EngineFileUtilities_Tests.cs" />
        </ItemGroup>
        <!-- Assemblies Files we depend on -->
        <ItemGroup>
          <Reference Include="System" />
          <Reference Include="System.Data" />
          <Reference Include="System.XML" />
          <Reference Include="System.Configuration" />		
      	<ProjectReference Include="..\..\Framework\Microsoft.Build.Framework.csproj" />
      	<ProjectReference Include="..\..\Utilities\Microsoft.Build.Utilities.csproj" />
          <ProjectReference Include="..\Engine\Microsoft.Build.Engine.csproj" />
      	<ProjectReference Include="..\..\Xunit.NetCore.Extensions\Xunit.NetCore.Extensions.csproj" />
      	
      	<PackageReference Include="NUnit" VersionOverride="2.5.7.10213" />
      	<PackageReference Include="Shouldly" />
      
        </ItemGroup>
        <ItemGroup>
          <!-- This config file has the binding redirect nunit needs to host MSBuild - it is automatically generated from a template -->
          <Template Include="App.config.tt">
            <OutputItemName>Content</OutputItemName>
          </Template>
        </ItemGroup>
        
        <PropertyGroup>
          <GenerateAssemblyAttribute>true</GenerateAssemblyAttribute>
        </PropertyGroup>
        <!-- IDE specific Information -->
        <ItemGroup>
          <AppDesigner Include="Properties\" />
        </ItemGroup>
      
        <Import Project="$(RepoRoot)eng\ProducesNoOutput.Settings.props" Condition="'$(OsEnvironment)'!='windows'" />
      </Project>
    • Converted XMakeConversionUnitTests.csproj
      <!-- #AnalyzingDotnet - this file has been completely rewritten -->
      <Project Sdk="Microsoft.NET.Sdk">
      
        <PropertyGroup Label="Dependencies">
          <UsingPartitionUnitTest>true</UsingPartitionUnitTest>
          <UsingProjectUnitTestUnitTestFramework>true</UsingProjectUnitTestUnitTestFramework>
        </PropertyGroup>
        <PropertyGroup>
          <TargetFramework>$(FullFrameworkTFM)</TargetFramework>
      	<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
          <IsUnitTestProject>true</IsUnitTestProject>
          <OutputPath>$(SuiteBinPath)</OutputPath>
          <OutputType>library</OutputType>
          <AssemblyName>Microsoft.Build.Conversion.Unittest</AssemblyName>
          <Nonshipping>true</Nonshipping>
          <SccProjectName>SAK</SccProjectName>
          <SccLocalPath>SAK</SccLocalPath>
          <SccAuxPath>SAK</SccAuxPath>
          <SccProvider>SAK</SccProvider>
          <BuildArchitecturesAllowed>$(BuildArchitecturesAllowed);amd64;arm</BuildArchitecturesAllowed>
        </PropertyGroup>
        <!-- IDE specific Information -->
        <PropertyGroup>
          <ProjectGuid>{9BDEE040-06EC-48F1-81A6-CDA7AA98CADA}</ProjectGuid>
          <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
          <!-- ProjectFileConverter.Convert(ProjectLoadSettings) has been obsoleted in favor of a different overload -->
          <NoWarn>$(NoWarn);0618</NoWarn>
        </PropertyGroup>
        <ItemGroup>
          <!-- Source Files -->
          <Compile Include="..\..\Shared\FxCopExclusions\Microsoft.Build.Shared.Suppressions.cs">
            <ExcludeFromStyleCop>true</ExcludeFromStyleCop>
          </Compile>
          <Compile Include="..\..\Shared\UnitTests\MockLogger.cs" />
          <Compile Include="..\..\Shared\UnitTests\ObjectModelHelpers.cs" />
      	<Compile Include="..\..\Shared\UnitTests\TestEnvironment.cs" />
      	<Compile Include="..\..\Shared\UnitTests\EngineTestEnvironment.cs" />
      	<Compile Include="..\..\Shared\Constants.cs" />
          <Compile Include="OldVSProjectFileReader_Tests.cs" />
          <Compile Include="ProjectFileConverter_Tests.cs" />
          <!-- Assemblies Files we depend on -->
          <Reference Include="System" />
          <Reference Include="System.Core" />
          <Reference Include="System.Data" />
          <Reference Include="System.XML" />
      	
          <ProjectReference Include="..\Engine\Microsoft.Build.Engine.csproj" />
      	<ProjectReference Include="..\Conversion\Microsoft.Build.Conversion.csproj" />
      	<ProjectReference Include="..\..\Build\Microsoft.Build.csproj" />
          <ProjectReference Include="..\..\Utilities\Microsoft.Build.Utilities.csproj" />
          <ProjectReference Include="..\..\Framework\Microsoft.Build.Framework.csproj" />
      	<ProjectReference Include="..\..\Xunit.NetCore.Extensions\Xunit.NetCore.Extensions.csproj" />
      	
          <PackageReference Include="MSTest.TestFramework" VersionOverride="1.1.18" />
      	<PackageReference Include="Shouldly" />
          
      	<!-- This config file has the binding redirect nunit needs to host MSBuild - it is automatically generated from a template -->
          <Template Include="..\..\Shared\UnitTests\App.config.tt">
            <OutputItemName>Content</OutputItemName>
          </Template>
        </ItemGroup>
        
        <PropertyGroup>
          <GenerateAssemblyAttribute>true</GenerateAssemblyAttribute>
        </PropertyGroup>
        <!-- IDE specific Information -->
        <ItemGroup>
          <AppDesigner Include="Properties\" />
        </ItemGroup>
        <ItemGroup>
          <Folder Include="Properties\" />
        </ItemGroup>
      
        <Import Project="$(RepoRoot)eng\ProducesNoOutput.Settings.props" Condition="'$(OsEnvironment)'!='windows'" />
      </Project>
  • Create Assertion.cs in Deprecated\Engine\Shared\UnitTests.

    • Assertion.cs
      // Copyright (c) Microsoft. All rights reserved.
      // Licensed under the MIT license. See LICENSE file in the project root for full license information.
      // #AnalyzingDotnet - original content
      
      #region Using directives
      
      using System;
      using NUnit.Framework;
      
      #endregion
      
      namespace Microsoft.Build.UnitTests
      {
          public static class Assertion
          {
              public static void Assert(bool shouldBeTrue)
              {
                  throw new NotImplementedException();
              }
      
              public static void Assert(string message, bool shouldBeTrue)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertEquals(object expected, object actual)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertEquals(string message, object expected, object actual)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertNotNull(object obj)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertNotNull(string message, object obj)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertNull(object obj)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertNull(string message, object obj)
              {
                  throw new NotImplementedException();
              }
      
              public static void Fail()
              {
                  throw new NotImplementedException();
              }
      
              public static void Fail(string message)
              {
                  throw new NotImplementedException();
              }
      
              public static void AssertSame(object first, object second)
              {
                  throw new NotImplementedException();
              }
          }
      }
  • Comment out Microsoft.DevDiv.Settings.targets and Microsoft.CSharp.targets imports, add empty Compile and CoreCompile targets in Tasks.UnitTests2\XMakeTasksUnitTests.csproj.

  • Convert UnitTests.Shared\Microsoft.Build.UnitTests.Shared.csproj to an SDK-style project and update some included items.

  • Converted UnitTests.Shared\Microsoft.Build.UnitTests.Shared.csproj
    <!-- #AnalyzingDotnet - this file has been completely rewritten -->
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
        <ProjectGuid>{E1ADB824-2B34-4920-953F-746DFD6DB3C1}</ProjectGuid>
        <OutputType>Library</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>Microsoft.Build.UnitTests.Shared</RootNamespace>
        <AssemblyName>Microsoft.Build.UnitTests.Shared</AssemblyName>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
        <DoNotLocalizeProject>true</DoNotLocalizeProject>
        <IsShipping>false</IsShipping>
      </PropertyGroup>
      <!-- Default configurations to help VS understand the configurations -->
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-MONO|AnyCPU'" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-MONO|AnyCPU'" />
      <ItemGroup Condition="'$(NetCoreBuild)' != 'true'">
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml" />
      </ItemGroup>
      <ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
        <!-- Need Win32 API on .NET Core to ping registry to determine long path support -->
        <PackageReference Include="Microsoft.Win32.Registry" />
      </ItemGroup>
      <ItemGroup>
        <Compile Include="..\Shared\AssemblyUtilities.cs">
          <Link>AssemblyUtilities.cs</Link>
        </Compile>
        <Compile Include="..\Shared\BuildEnvironmentHelper.cs">
          <Link>BuildEnvironmentHelper.cs</Link>
        </Compile>
        <!--<Compile Include="..\Shared\Compat\SafeHandleZeroOrMinusOneIsInvalid.cs"  Condition="'$(NetCoreBuild)' == 'true'">
          <Link>SafeHandleZeroOrMinusOneIsInvalid.cs</Link>
        </Compile>-->
        <Compile Include="..\Shared\Constants.cs">
          <Link>Constants.cs</Link>
        </Compile>
        <Compile Include="..\Shared\ErrorUtilities.cs">
          <Link>ErrorUtilities.cs</Link>
        </Compile>
        <Compile Include="..\Shared\EscapingUtilities.cs">
          <Link>EscapingUtilities.cs</Link>
        </Compile>
        <Compile Include="..\Shared\ExceptionHandling.cs">
          <Link>ExceptionHandling.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileUtilities.cs">
          <Link>FileUtilities.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileUtilitiesRegex.cs">
          <Link>FileUtilitiesRegex.cs</Link>
        </Compile>
        <Compile Include="..\Shared\InternalErrorException.cs">
          <Link>InternalErrorException.cs</Link>
        </Compile>
        <Compile Include="..\Shared\NativeMethodsShared.cs">
          <Link>NativeMethodsShared.cs</Link>
        </Compile>
        <Compile Include="..\Shared\IInternable.cs">
          <Link>IInternable.cs</Link>
        </Compile>
        <Compile Include="..\Shared\WeakStringCache.cs">
          <Link>WeakStringCache.cs</Link>
        </Compile>
        <Compile Include="..\Shared\WeakStringCache.Concurrent.cs">
          <Link>WeakStringCache.Concurrent.cs</Link>
        </Compile>
        <Compile Include="..\Shared\OpportunisticIntern.cs">
          <Link>OpportunisticIntern.cs</Link>
        </Compile>
        <Compile Include="..\Shared\ResourceUtilities.cs">
          <Link>ResourceUtilities.cs</Link>
        </Compile>
        <Compile Include="..\Shared\StringBuilderCache.cs">
          <Link>StringBuilderCache.cs</Link>
        </Compile>
        <Compile Include="..\Shared\Traits.cs">
          <Link>Traits.cs</Link>
        </Compile>
        <Compile Include="..\Shared\VisualStudioLocationHelper.cs">
          <Link>VisualStudioLocationHelper.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\IFileSystem.cs">
          <Link>IFileSystem.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\FileSystems.cs">
          <Link>FileSystems.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\MSBuildOnWindowsFileSystem.cs">
          <Link>MSBuildOnWindowsFileSystem.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\ManagedFileSystem.cs">
          <Link>ManagedFileSystem.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\WindowsFileSystem.cs">
          <Link>WindowsFileSystem.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\WindowsNative.cs">
          <Link>WindowsNative.cs</Link>
        </Compile>
    	<Compile Include="..\Shared\FileSystem\NativeWin32Exception.cs">
          <Link>NativeWin32Exception.cs</Link>
        </Compile>
        <Compile Include="..\Shared\FileSystem\SafeFileHandle.cs">
          <Link>SafeFileHandle.cs</Link>
        </Compile>
        <Compile Include="AssemblyResources.cs" />
        <Compile Include="RunnerUtilities.cs" />
      </ItemGroup>
      <ItemGroup>
        <ProjectReference Include="..\Utilities\Microsoft.Build.Utilities.csproj">
          <Project>{828566ee-6f6a-4ef4-98b0-513f7df9c628}</Project>
          <Name>Microsoft.Build.Utilities</Name>
        </ProjectReference>
    	<PackageReference Include="xunit.core" />
      </ItemGroup>
      <ItemGroup>
        <None Include="project.json" />
      </ItemGroup>    
    </Project>  
    </details>
  • Retarget Build.UnitTests\Microsoft.Build.Engine.UnitTests.csproj to netcoreapp2.1 as it has a dependency on a net35 project that is not buildable (or, apparently, referenceable in a reliable fashion) with a modern SDK.

SixLabors/ImageSharp

  • Build the solution: dotnet build ImageSharp.sln.
  • Comment out the explicit StyleCop.Analyzers PackageReference as well as the corresponding stylecop.json AdditionalFile in SharedInfrastructure.Tests.csproj.

In progress

dotnet/wpf

  • Import Documentation\wpf.vsconfig into your Visual Studio configuration.
  • Build the solution: .\build -warnAsError 0.
  • WIP

Avalonia/Avalonia

  • Build Avalonia.iOS with an SDK that supports Xamarin:
    • dotnet ..\..\..\..\..\..\SDK\dotnet.dll build Avalonia.iOS.csproj
  • WIP

Windows Community Toolkit

  • Build the solution in Visual Studio.
  • Comment out Nerdbank.GitVersioning in Directory.Build.props.
  • WIP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment