New project file format

Why?

  • how reference .net standard libs in .net framework project?
  • dotnet issue

What it looked like

What it looks like

Migration

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <RootNamespace>DD.Database</RootNamespace>
    <AssemblyName>DD.Database</AssemblyName>
    <Name>DD.Database</Name>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="..\GlobalAssemblyInfo.cs">
      <Link>Properties\GlobalAssemblyInfo.cs</Link>
    </Compile>
    <Compile Include="..\VersionInfo.cs">
      <Link>Properties\VersionInfo.cs</Link>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Util.Lib" Version="1.0.0.*" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\OtherProjectInSln.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Reference to some windows libs />
  </ItemGroup>
</Project>

pros

readability

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <RootNamespace>DD.Database</RootNamespace>
    <AssemblyName>DD.Database</AssemblyName>
    <Name>DD.Database</Name>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="..\GlobalAssemblyInfo.cs">
      <Link>Properties\GlobalAssemblyInfo.cs</Link>
    </Compile>
    <Compile Include="..\VersionInfo.cs">
      <Link>Properties\VersionInfo.cs</Link>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Castle.Common.Lang" Version="1.0.0.*" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\OtherProjectInSln.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Reference to some windows libs />
  </ItemGroup>
</Project>

length

ability to specify not concrete version

1: 
2: 
3: 
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="6.0.*" />
  </ItemGroup>

package information in one place

1: 
2: 
3: 
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="6.0.*" />
  </ItemGroup>

we don't have to unload project

automatic detection of cycles

automatic detection of package(s) downgrade

we don't have to specify all files included

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
<ItemGroup>
    <Compile Include="..\GlobalAssemblyInfo.cs">
        <Link>Properties\GlobalAssemblyInfo.cs</Link>
    </Compile>
    <Compile Include="..\VersionInfo.cs">
        <Link>Properties\VersionInfo.cs</Link>
    </Compile>
</ItemGroup>

easy migrate to .net core

1: 
2: 
3: 
<PropertyGroup>
    <TargetFramework>net462;netstandard2.0</TargetFramework>
</PropertyGroup>

generate nuget package throw visual studio

1: 
2: 
3: 
<PropertyGroup>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

packages in one place

  • all packages are located in .nuget folder
  • packages are not downloaded per solution

problems

automatic generation of assembly info

1: 
2: 
3: 
<PropertyGroup>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

generation of nuget package throw nuget client

msbuild tasks migration

specifing not concrete version of package

  • what with package doesn't respect semantic versioning?
  • System.Data.SqlLite.x64 ver 1.0.106 vs 1.0.76

teamcity and hardcoded paths to bin folder

  • buildsteps sometimes contains path to dlls
  • after migration dlls goes not to the /bin folder but /bin/{targetFramework}

you have to update visual studio

  • minimum version to support all msbuild magic is 15.2
  • update of all agents

resharper build

running tests using machine.specifications

what with web projects

package references instead of packages.config

proces of migration

  • add to csproj
1: 
2: 
3: 
<PropertyGroup>
    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
  • delete packages.config
  • reinstall all packages

what we have thanks to that

1: 
2: 
3: 
4: 
<ItemGroup>
    <PackageReference Include="Ben.Demystifier">
    <Version>0.0.5</Version>
</PackageReference>

thanks