...
The new format released with visual studio 2017. Visual Studio 2019.
Main changes are:
- cs files are included by default. They need to be included if you are doing special things with them (e.g. linking xaml files to their cs backing file)
- project references now bring in implicit references of what it references (e.g. A →B and B → C, now A implicitly references C)
- this includes everything C references as well (e.g. if C reference wpf then A will reference wpf)
- Choose/When msbuild constructs don't seem to work the same
- AssemblySearchPaths is used instead of ReferencePaths
...
- TargetFramework - net48
- LangVersion - 7.3
- NoWarn - 1591,1587
- RootPath - depends on csproj and sln location
- AssemblySearchPaths - includes RootPath/3rdParty
- OutputPath - RootPath/Output
- AssemblyTitle - csproj file name
<Import Project="$(RootPath)
TIMERiverSystem\Solutions\
IncludeGlobalAssemblySDK.build.
targetsprops" />
is set<Import Project="$(RootPath)RiverSystem\Solutions\
NormalisePdbBuildRootSDK.build.targets" />
is set<Import Project
References are set using <ProjectReference Include="
..\TIME\TIME.csproj$(RootPath)RiverSystem\Solutions\SDKIncludeGlobalAssembly.targets" />
- dll references are set with
- private = false
- specific version = false
Notes:
- is set
<Import Project="$(RootPath)TIMERiverSystem\Solutions\IncludeGlobalAssembly.targets" />
to set the global assembly - no AssemblyInfo 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
Notes:
<Import Project="$(RootPath)RiverSystem\Solutions\SDK.build.props" />
- AppendTargetFrameworkToOutputPath, AppendRuntimeIdentifierToOutputPath and WarningsAsErrors are set by
SDK.build.props
- this is to stop the /win/x64 folders from being generated
- AppendTargetFrameworkToOutputPath, AppendRuntimeIdentifierToOutputPath and WarningsAsErrors are set by
<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\NormalisePdbBuildRoot.targets" />
to configure the normalization of pdbs- CopyReferences are done via the Directory.Build.targets (currently lives in time)
- AppendTargetFrameworkToOutputPath, AppendRuntimeIdentifierToOutputPath and WarningsAsErrors are set by Directory.Build.propsthis is to stop the /win/x64 folders from being generated
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
- 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/13.60.6838
" (from https://www.nuget.org/packages/MSBuild.Sdk.Extras) - For WPF add
<ExtrasEnableWpfProjectSetup>true<<UseWPF>true</ExtrasEnableWpfProjectSetup>UseWPF>
to thePropertyGroup
- For WinForms add
<ExtrasEnableWinFormsProjectSetup>true<<UseWindowsForms>true</ExtrasEnableWinFormsProjectSetup> UseWindowsForms>
to thePropertyGroup
- Remove
EmbeddedResource
entreies for ".resx" files and the associatedCompile
of ".designer.resx" files - Remove
Compile
entries of ".cs"UserControl
,Form
andComponent
files and associated ".designer.cs" files - Remove
Compile
entries of ".xaml.cs" files and associated ".xaml"Page
files
- Change the SDK from "
Add entries using wildcards for resources if they exist similar to the following:
Code Block language xml <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
...
Expand | |||||||
---|---|---|---|---|---|---|---|
| |||||||
|
...
- Easiest way to install this is via dotnet cli tooling:
- dotnet tool install -g Project2015To2017.Migrate2017Migrate2019.Tool\
- Then to run the conversion:
- dotnet migrate-2017 2019 wizard old-output-path C:\src\rm3\riversystem\Solutions\<solution>.sln
- Tidy up using regex:
<ReferencePath>$(RootPath)3rdParty</ReferencePath> → <AssemblySearchPaths>$(RootPath)3rdParty;$(AssemblySearchPaths);</AssemblySearchPaths>
- Make additional changes as outlined in Notes above.
- Remove old junk which isn't needed anymore.