Wyamio / Wyam

A modular static content and static site generator.
MIT License
141 stars 29 forks source link

Support other framework versions #27

Open mcraiha opened 3 years ago

mcraiha commented 3 years ago

Some CI/CD pipelines do include dotnet by default, but it is not usually version 2.1 and if someone tries to use Wyam with those machines, it installs just fine but produces following error when one tries to execute it The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

so would it be possible to support multiple frameworks? https://docs.microsoft.com/en-us/dotnet/core/tools/troubleshoot-usage-issues#runtime-not-found

daveaglick commented 3 years ago

Sorry, not at this time. Wyam is essentially archived and no new development is happening. I'd suggest you check out Statiq as the spiritual successor to Wyam. Note that it too also requires .NET Core 3.1 or higher and I have no plans to multi-target.

Maybe I can help get .NET Core on your CI server though? Almost all the ones I know about either support .NET Core build images, built-in tasks to install certain .NET Core versions, or can run a .NET Core install from CI. Which CI service are you having trouble on?

mcraiha commented 3 years ago

I can install other dotnet versions with dotnet-install.sh, but installing another version increases build times since dotnet download sizes are quite substantial

e.g. Cloudflare Pages doesn't provide any selectable dotnet version parameter nor image

But I understand that Wyam is not maintained anymore, so I should see about wyam -> statiq upgrade

johncrim commented 2 years ago

We recently started running into problems with wyam being compiled against .NET 2.1, since .NET Core 2.1 is no longer installed by default on Azure DevOps build agents (recent change, it seems). This error starting showing up:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.1.0' (x64) was not found.
  - The following frameworks were found:
      3.1.4 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      3.1.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      3.1.20 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      3.1.22 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      5.0.4 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      5.0.9 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      5.0.14 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      6.0.2 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.1.0&arch=x64&rid=ubuntu.18.04-x64

I'm with @mcraiha - don't like to slow builds by installing things on every build that aren't strictly required. I was going to see if I could patch the build or convince @daveaglick to accept a PR changing to <TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>, but then I read about .NET's roll-forward support, which allows using newer frameworks with libraries linked to older frameworks.

The workaround for us was to update our builds to set environment variable DOTNET_ROLL_FORWARD=Major:

      - name: Build site
        run: |
          dotnet wyam build site -s Minify=true -o ../../$OUT_DIR
        env:
          DOTNET_ROLL_FORWARD: Major
daveaglick commented 2 years ago

Nice! Thanks a ton for coming back and updating here @johncrim! I actually might have considered a multi-targeting PR as long as it required no additional effort on my part :), but almost three years out I'm not even sure I've got the tooling to build and release Wyam reliably any more. I'm very happy you were able to work around this using the .NET tooling.

johncrim commented 2 years ago

I figured as much - I was worried about the viability of the build/release part. I'm also happy/impressed that the .NET team has a good story for such things, and it's documented.

We will migrate to Statiq one of these days, I'm a fan of your efforts in this space, so I'm happy to help.

As an aside, I created and sold an ASP-classic derived static site generation product in the mid-late 90s/early 00s (Active Page Generator by WebGecko software - JScript FTW!).

daveaglick commented 2 years ago

As an aside, I created and sold an ASP-classic derived static site generation product in the mid-late 90s/early 00s (Active Page Generator by WebGecko software - JScript FTW!).

Awesome! If we ever meet in-person I'll buy you a beer or other beverage of your choice and you can teach me the secret handshake of the Static Site Generator Developers society.