Versions Compared

Key

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

...

Conversion process:

The pre visual studio 2017 format that was used by source before 2020 was maintained by ProjectChecker.exe on teamcity (and locally).

The core settings that were maintained were:

  • Target Framework - .Net 4.8
  • Tools Version - 15.0
  • LangVersion - C# 7.3, VB 15
  • General settings including WarningLevel, NoWarn, Prefer32Bit, Debug symbols, Optimize, etc.
  • RootPath - the root of our folder structure which all of our repository folders sit in; defined as a relative path from the project file location.
  • Import NormailsePdbBuildRoot targets
  • Output paths
    • Core projects -> $(RootPath)Output
    • Core Plugin projects -> $(RootPath)Output\Plugins
    • Community Plugin projects -> $(RootPath)Output\Plugins\CommunityPlugins
  • ReferencePath (output path isn't needed to be included as it's automatically used)
    • Core projects -> $(RootPath)3rdParty
    • Plugins -> $(RootPath)Output;$(RootPath)3rdParty
  • Project references
    • Convert dll references to project references if within same solution
    • Convert project references to dll references if within different solution (cannot use project references as the the build configuration to use is defined in the solution not the project i.e. debug will be used by default when building release)
    • Set copy local (private) to false
  • Dll references
    • Remove version and PublicKeyToken information
    • Remove HintPath
    • Set specific version to false
    • Set copy local (private) to false if part of .Net framework
    • Source solution
      • Set copy local (private) to true if not part of .Net framework
    • Plugins solution
      • Set copy local (private) to false if project from Source solution
      • Set copy local (private) to false if (directly) referenced by project from Source solution
      • Set copy local (private) to true for everything else (i.e. only referenced by a plugin)

Note: ProjectChecker.exe was only run on Source.sln and SourceCommunityPlugins.sln (i.e. doesn't get run on the Not to be distributed plugins).

...

titleOld csproj example

...

languagexml
titleOld TIME.csproj
linenumberstrue

...

conversion process can be partially automated using a tool. The process to convert projects as are follows:

  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 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.

Old Format:

The pre visual studio 2017 format that was used by source before 2020 was maintained by ProjectChecker.exe on teamcity (and locally).

The core settings that were maintained were:

  • Target Framework - .Net 4.8
  • Tools Version - 15.0
  • LangVersion - C# 7.3, VB 15
  • General settings including WarningLevel, NoWarn, Prefer32Bit, Debug symbols, Optimize, etc.
  • RootPath - the root of our folder structure which all of our repository folders sit in; defined as a relative path from the project file location.
  • Import NormailsePdbBuildRoot targets
  • Output paths
    • Core projects -> $(RootPath)Output
    • Core Plugin projects -> $(RootPath)Output\Plugins
    • Community Plugin projects -> $(RootPath)Output\Plugins\CommunityPlugins
  • ReferencePath (output path isn't needed to be included as it's automatically used)
    • Core projects -> $(RootPath)3rdParty
    • Plugins -> $(RootPath)Output;$(RootPath)3rdParty
  • Project references
    • Convert dll references to project references if within same solution
    • Convert project references to dll references if within different solution (cannot use project references as the the build configuration to use is defined in the solution not the project i.e. debug will be used by default when building release)
    • Set copy local (private) to false
  • Dll references
    • Remove version and PublicKeyToken information
    • Remove HintPath
    • Set specific version to false
    • Set copy local (private) to false if part of .Net framework
    • Source solution
      • Set copy local (private) to true if not part of .Net framework
    • Plugins solution
      • Set copy local (private) to false if project from Source solution
      • Set copy local (private) to false if (directly) referenced by project from Source solution
      • Set copy local (private) to true for everything else (i.e. only referenced by a plugin)

Note: ProjectChecker.exe was only run on Source.sln and SourceCommunityPlugins.sln (i.e. doesn't get run on the Not to be distributed plugins).

Expand
titleOld csproj example
Code Block
languagexml
titleOld TIME.csproj
linenumberstrue
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="15.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <ProjectGuid>{EEC5CF45-EBEE-4CEB-9335-A383C4749688}</ProjectGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>TIME</RootNamespace>
    <AssemblyName>TIME</AssemblyName>
    <StartupObject />
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <LangVersion>7.3</LangVersion>
    <NoWarn>1591,1587</NoWarn>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningLevel>4</WarningLevel>
    <RootPath>$(MSBuildThisFileDirectory)..\..\</RootPath>
    <ReferencePath>$(RootPath)3rdParty</ReferencePath>
    <OutputPath>$(RootPath)Output</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <OutputPath>$(RootPath)Output</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugSymbols>true</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoWarn>1591,1587</NoWarn>
    <Optimize>false</Optimize>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningLevel>4</WarningLevel>
    <DebugType>portable</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <OutputPath>$(RootPath)Output</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <DefineConstants>TRACE</DefineConstants>
    <DebugSymbols>false</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoWarn>1591,1587</NoWarn>
    <Optimize>true</Optimize>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningLevel>4</WarningLevel>
    <DebugType>portable</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="CsvHelper">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="gdal_csharp">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="LZ4">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="MathNet.Numerics">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.CSharp">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.Office.Interop.Excel">
      <EmbedInteropTypes>True</EmbedInteropTypes>
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.Practices.EnterpriseLibrary.Common">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.Practices.EnterpriseLibrary.Validation">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="Newtonsoft.Json">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="ogr_csharp">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="PresentationCore">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Drawing">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Reactive">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Runtime.Serialization.Formatters.Soap">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <ProjectReference Include="..\TIME.NetCDF\TIME.NetCDF.csproj">
      <Project>{D3F02F27-C0B1-4ED9-86D3-AA1733270179}</Project>
      <Name>TIME.NetCDF</Name>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </ProjectReference>
    <Reference Include="PresentationFramework">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.ComponentModel.DataAnnotations">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.IO.Compression">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xaml">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="WindowsBase">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="SciChart.Charting">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="BinarySerializer.cs" />
    <!-- Compiles removed for reability --> 
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <Compile Include="DataTypes\IO\CsvFileIo\GeneralCsvFileIo.Load.cs" />
    <Compile Include="DataTypes\IO\CsvFileIo\TimeSeriesInfo\BigModTimeseriesInfo.cs" />
    <None Include="key.snk" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <Compile Include="Science\Algebra\Algorithms.cs" />

    <Compile Include="Science\Mathematics\Functions\InterpolatedFunction.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Science\Mathematics\Functions\LinearPerPartFunction.cs" />
    <Compile Include="Science\VectorOperations\PolygonTools\Winding.cs" />
    <Compile Include="Science\VectorOperations\UnionGEORegions.cs" />
    <None Include="Science\Statistics\ClassDiagram.cd" />
    <RootContent Include="Resources\GDAL\coordinate_axis.csv" />
    <RootContent Include="Resources\GDAL\datum_shift.csv" />
    <RootContent Include="Resources\GDAL\ellipsoid.csv" />
    <RootContent Include="Resources\GDAL\gcs.csv" />
    <RootContent Include="Resources\GDAL\gcs.override.csv" />
    <RootContent Include="Resources\GDAL\gdal_datum.csv" />
    <RootContent Include="Resources\GDAL\gt_datum.csv" />
    <RootContent Include="Resources\GDAL\gt_ellips.csv" />
    <RootContent Include="Resources\GDAL\pcs.csv" />
    <RootContent Include="Resources\GDAL\pcs.override.csv" />
    <RootContent Include="Resources\GDAL\prime_meridian.csv" />
    <RootContent Include="Resources\GDAL\projop_wparm.csv" />
    <RootContent Include="Resources\GDAL\s57agencies.csv" />
    <RootContent Include="Resources\GDAL\s57attributes.csv" />
    <RootContent Include="Resources\GDAL\s57attributes_aml.csv" />
    <RootContent Include="Resources\GDAL\s57attributes_iw.csv" />
    <RootContent Include="Resources\GDAL\s57expectedinput.csv" />
    <RootContent Include="Resources\GDAL\s57objectclasses.csv" />
    <RootContent Include="Resources\GDAL\s57objectclasses_aml.csv" />
    <RootContent Include="Resources\GDAL\s57objectclasses_iw.csv" />
    <RootContent Include="Resources\GDAL\stateplane.csv" />
    <RootContent Include="Resources\GDAL\unit_of_measure.csv" />
  </ItemGroup>
  <ItemGroup>
    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
    <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
      <Visible>False</Visible>
      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
      <Visible>False</Visible>
      <ProductName>Windows Installer 3.1</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Resources\Toolkit\" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\FinderBlackList.txt" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(RootPath)RiverSystem\Solutions\PostAndPreBuildScript.targets" />
  <Import Project="$(RootPath)RiverSystem\Solutions\IncludeGlobalAssembly.targets" />
  <Target Name="CopyRootContent" AfterTargets="AfterBuild">
    <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(RootContent)" SkipUnchangedFiles="true" />
  </Target>
  <Import Project="$(RootPath)RiverSystem\Solutions\NormalisePdbBuildRoot.targets" />
</Project>

...

Expand
titleNew csproj example
Code Block
languagexml
linenumberstrue
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyTitle>TIME.RainfallRunoff</AssemblyTitle>
    <TargetFramework>net48</TargetFramework>
    <LangVersion>7.3</LangVersion>
    <NoWarn>1591,1587</NoWarn>
    <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\SDKIncludeGlobalAssembly.targets" />
  <Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.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>

Conversion process:

The conversion process can be partially automated using a tool. The process to convert projects as are follows:

...

  1. dotnet tool install -g Project2015To2017.Migrate2019.Tool\

...

  1. dotnet migrate-2019 wizard old-output-path  C:\src\rm3\riversystem\Solutions\<solution>.sln

...

  1.  <ReferencePath>$(RootPath)3rdParty</ReferencePath><AssemblySearchPaths>$(RootPath)3rdParty;$(AssemblySearchPaths);</AssemblySearchPaths>

...