Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install the tool via dotnet cli:
    1. dotnet tool install -g Project2015To2017.Migrate2019.Tool\
  2. Then to run the conversion:
    1. dotnet migrate-2019 wizard old-output-path  C:\src\rm3\riversystem\Solutions\<solution>.sln
  3. Tidy up using regex:
    1.  <ReferencePath>$(RootPath)3rdParty</ReferencePath><AssemblySearchPaths>$(RootPath)3rdParty;$(AssemblySearchPaths);</AssemblySearchPaths>

  4. Make additional changes as outlined in Notes for the the New Format section below.
  5. Remove duplicate entries which are often added by removing and collapsing the Release and Debug sections.
  6. Remove old junk which isn't needed anymore.

...

  • TargetFramework - net48
  • LangVersion - 7.3NoWarn - 1591,1587
  • RootPath - depends on csproj and sln location
  • AssemblySearchPaths - includes RootPath/3rdParty
  • OutputPath - RootPath/Output
  • AssemblyTitle - not needed if the same as the csproj file name (minus the extension)
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.props" /> is set
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.targets" /> is set
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDKIncludeGlobalAssembly.targets" /> is set
  • <Import Project="$(RootPath)RiverSystem\Solutions\IncludeGlobalAssembly.targets" /> is not set
  • <Import Project="$(RootPath)RiverSystem\Solutions\NormalisePdbBuildRoot.targets" /> is set
  • References to projects within the same solution are set using ProjectReference entires e.g. <ProjectReference Include="..\TIME\TIME.csproj" />
  • dll references are set with
    • private = false
    • specific version = false

...

  • <Import Project="$(RootPath)RiverSystem\Solutions\UnitTests.props" /> is set for projects containing unit tests
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDKUnitTests.build.propstargets" />
    • AppendTargetFrameworkToOutputPath, AppendRuntimeIdentifierToOutputPath and WarningsAsErrors are set by SDK.build.props
      • this is to stop the /win/x64 folders from being generated
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDKIncludeGlobalAssembly.targets" />
    • to set the global assembly - no AssemblyInfo.cs is required anymore - these properties are set in the csproj file now
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.targets" />Copy 3rdParty to output is done via the SDK.build.targetsthis is done since the Choose/When directives don't seem to work when running the builds via cake/msbuild (they work ok with visual studio 2017/2019) is set for projects containing unit tests
  • <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> is removed (will have been added in unit test projects by old versions of Visual Studio)
  • <Reference Include="nunit.framework"> is removed
  • References to projects within the same solution are set using ProjectReference entires e.g. <ProjectReference Include="..\TIME\TIME.csproj" />
  • dll references are set with
    • private = false
    • specific version = false

Additional Notes:

  • <Import Project="$(RootPath)RiverSystem\Solutions\NormalisePdbBuildRootSDK.build.targetsprops" />
  • to configure the normalization of pdb build paths
  • Compile Remove="file.cs" should be deleted and the "file.cs" should be deleted from the git repo as well.
  • For projects containing WPF or WinForms make the the following changes:
    • Change the SDK from "Microsoft.NET.Sdk" to "MSBuild.Sdk.Extras/3.0.38" (from https://www.nuget.org/packages/MSBuild.Sdk.Extras)
    • For WPF add <UseWPF>true</UseWPF> to the PropertyGroup
    • For WinForms add <UseWindowsForms>true</UseWindowsForms> to the PropertyGroup
    • Remove EmbeddedResource entreies for ".resx" files and the associated Compile of ".designer.resx" files
    • Remove Compile entries of ".cs" UserControl, Form and Component files and associated ".designer.cs" files
    • Remove Compile entries of ".xaml.cs" files and associated ".xaml" Page files
  • Add entries using wildcards for resources if they exist similar to the following:

    Code Block
    languagexml
      <ItemGroup>
        <EmbeddedResource Include="Persistence\Mappings\*.hbm.xml" />
        <EmbeddedResource Include="Persistence\SchemaUpgrades\*.sql" />
        <Resource Include="Resources\**\*">
          <Pack>True</Pack>
        </Resource>
      </ItemGroup>
    • Remove individual entries for resources

Example:

...

titleNew csproj example

...

languagexml
linenumberstrue

...

    • AppendTargetFrameworkToOutputPath, AppendRuntimeIdentifierToOutputPath and WarningsAsErrors are set by SDK.build.props
      • this is to stop the /win/x64 folders from being generated
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDKIncludeGlobalAssembly.targets" />
    • to set the global assembly - no AssemblyInfo.cs is required anymore - these properties are set in the csproj file now
  • <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.targets" />
    • Copy 3rdParty to output is done via the SDK.build.targets
      • this is done since the Choose/When directives don't seem to work when running the builds via cake/msbuild (they work ok with visual studio 2017/2019)
  • <Import Project="$(RootPath)RiverSystem\Solutions\NormalisePdbBuildRoot.targets" />
    • to configure the normalization of pdb build paths
  • For unit test projects
    • Add <Import Project="$(RootPath)RiverSystem\Solutions\UnitTests.props" />
    • Add <Import Project="$(RootPath)RiverSystem\Solutions\UnitTests.targets" />
    • Remove <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
    • Remove <Reference Include="nunit.framework">
  • Compile Remove="file.cs" should be deleted and the "file.cs" should be deleted from the git repo as well.
  • For projects containing WPF or WinForms make the the following changes:
    • Change the SDK from "Microsoft.NET.Sdk" to "MSBuild.Sdk.Extras/3.0.38" (from https://www.nuget.org/packages/MSBuild.Sdk.Extras)
    • For WPF add <UseWPF>true</UseWPF> to the PropertyGroup
    • For WinForms add <UseWindowsForms>true</UseWindowsForms> to the PropertyGroup
    • Remove EmbeddedResource entreies for ".resx" files and the associated Compile of ".designer.resx" files
    • Remove Compile entries of ".cs" UserControl, Form and Component files and associated ".designer.cs" files
    • Remove Compile entries of ".xaml.cs" files and associated ".xaml" Page files
  • Add entries using wildcards for resources if they exist similar to the following:

    Code Block
    languagexml
      <ItemGroup>
        <EmbeddedResource Include="Persistence\Mappings\*.hbm.xml" />
        <EmbeddedResource Include="Persistence\SchemaUpgrades\*.sql" />
        <Resource Include="Resources\**\*">
          <Pack>True</Pack>
        </Resource>
      </ItemGroup>


    • Remove individual entries for resources

Example:

Expand
titleNew csproj example
Code Block
languagexml
linenumberstrue
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <LangVersion>7.3</LangVersion>
    <RootPath>$(MSBuildThisFileDirectory)..\..\</RootPath>
    <AssemblySearchPaths>$(RootPath)3rdParty;$(AssemblySearchPaths);</AssemblySearchPaths>
    <OutputPath>$(RootPath)Output</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <FileAlignment>4096</FileAlignment>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <BaseAddress>285212672</BaseAddress>
  </PropertyGroup>
  <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.props" />
  <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.targets" />
  <Import Project="$(RootPath)RiverSystem\Solutions\SDKIncludeGlobalAssembly.targets" />
  <Import Project="$(RootPath)RiverSystem\Solutions\NormalisePdbBuildRoot.targets" />
  <ItemGroup>
    <Reference Include="Microsoft.Practices.EnterpriseLibrary.Validation">
      <Private>True</Private>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System.ComponentModel.DataAnnotations">
      <Private>False</Private>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\TIME\TIME.csproj" />
    <ProjectReference Include="..\TIME.Tools\TIME.Tools.csproj" />
  </ItemGroup>
  <ItemGroup>
    <None Include="AWRA\AWRA.cd" />
  </ItemGroup>
</Project>

ProjectChecker replacement

ProjectChecker has been modifed to skip SDK format projects. This means that incorrect settings are no longer going to be reported in the TeamCity ProjectChecker build. In particular this means that copy local setting errors will not be reported. ProjectChecker wasn't able to properly handle secondary / indirect references so the copy local settings didn't always work properly anyway. As a replacement there is a build task in the RiverSystem\Build\Scripts\SourceTargets.cake file, "__CleanDuplicatesFromPluginFolders". This task will delete files from the plugin output folders which are also in the base output folder. Any files deleted will be reported in the build log but there won't be a warning or error when this occurs. We could change this to report a build warning on TeamCity.