hvanbakel / CsprojToVs2017

Tooling for converting pre 2017 project to the new Visual Studio 2017 format.
MIT License
1.08k stars 120 forks source link

Is there an up-to-date nuget c# sample? I was having trouble getting things to compile. #315

Open DerekSMorin opened 5 months ago

DerekSMorin commented 5 months ago

Is there an up-to-date nuget c# sample? I was having trouble getting things to compile.

I was having trouble finding the MigrationFacility class.

mungojam commented 5 months ago

Is there an up-to-date nuget c# sample? I was having trouble getting things to compile.

I was having trouble finding the MigrationFacility class.

@DerekSMorin Can you try this:

Program.cs

using Microsoft.Extensions.Logging.Abstractions;
using Project2015To2017;

var facility = new MigrationFacility(new NullLogger<MigrationFacility>());

facility.ExecuteMigrate(
    [ @"C:\full-path-to-solution-or-project-file.sln" ],
    new BasicTransformationSet()
);

project file

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
    <PackageReference Include="Project2015To2017" Version="4.2.0" />
  </ItemGroup>

</Project>
DerekSMorin commented 5 months ago

@mungojam - thank you so much! I think my issue was using the: Project2015To2017.Migrate2019.Library nuget package rather than Project2015To2017