Porting Blog to MacOS

I have an old .NET project I started about twenty years ago that I use to publish updates to my website.

A few months back, I decided to port it to run on MacOS, and I thought it might be useful to write down some notes on how that went.

And that's it! About a day's work, mostly because I had not worked with dotnet core for a bit and had to account for how to get everything working with command-line tools only.

The New Project

For future reference, this is what the new project file looks like.

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>

    <!-- disable some things for compatibility with older C# -->
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>disable</Nullable>

    <!-- NOHTML is used to remove dependency on resources -->
    <DefineConstants>NOHTML</DefineConstants>
    <!-- We already have an AssemblyInfo.cs generated -->
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <!-- We need unsafe code -->
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="CommandLineParser" Version="2.9.1" />
    <PackageReference Include="FluentFTP" Version="42.2.0" />
  </ItemGroup>

  <ItemGroup>
    <Compile Include="../MyWebManager/BuildEngine.cs" />
    <Compile Include="../MyWebManager/IFtpHelper.cs" />
    <Compile Include="../MyWebManager/FtpHelperNet.cs" />
    <Compile Include="../MyWebManager/Resources.cs" />
    <Compile Include="../MyWebManager/UploadEngine.cs" />
    <Compile Include="../MyWebManager/WebOptions.cs" />
    <Compile Include="../MyWebManager/Converters/HtmlToXhtmlConverter.cs" />
    <Compile Include="../MyWebManager/Converters/MarkdownToPostConverter.cs" />
    <Compile Include="../MyWebManager/Utils/XmlUtils.cs" />
  </ItemGroup>

</Project>

Happy porting!

Tags:  codingdotnet

Home