microsoft / github-actions-for-desktop-apps

This repo contains a sample WPF application to demonstrate how to create CI/CD pipelines using GitHub Actions.
MIT License
353 stars 108 forks source link

This doesn't seem to build once forked.. #48

Closed benstaniford closed 1 year ago

benstaniford commented 1 year ago

I tried for a day or so to get my own project to build via this method but couldn't due to some very obscure errors that I couldn't seem to google. In the end I thought I might clone this sample and tinker with it to suit my needs but once I'd forked it, I found it doesn't seem to build any more:

image

Here's the CI output:

https://github.com/benstaniford/github-actions-for-desktop-apps/actions/runs/3197448618

LanceMcCarthy commented 1 year ago

That error usually means some sort of an SDK issue.

This demo uses NET Core 3.1 and Project reunion (WinAppSDK 0.8.x). The end of life for this pathway is 0.8 because WinUI dropped WPF, so it will never go over 1.x

If you want to see a more modern approach in a production WPF app (which is built as a .NET app), take a look at my builds here where I build CI and also CD for both appinstaller and Microsoft Store.

[edit] Cleaned up formatting

LanceMcCarthy commented 1 year ago

Side Note: it's been 2 years since main has been built. I am investigating now and will push any needed changes so that main is built successfully.

benstaniford commented 1 year ago

Thanks @LanceMcCarthy , I'll check out that project. I'm actually looking at writing a Windows service which consumes ETW events, and my initial inclination was to do it all in C++ but I thought I'd investigate Self-contained .Net Core + Build everything on GitHub as part of my initial research which is what lead me here. Thanks for answering.

LanceMcCarthy commented 1 year ago

I don't see any reason why you couldn't do that. GH Actions have been an absolute savior for me (in many many projects) to automate the build process and produce the desired artifact.

With a self-contained, single executable .NET app (I would choose .NET6), you do not have to package it in MSIX unless you need distribution/installation capabilities. You can get a single-file executable if that's all you're looking for (the MSIX makes it easier to distribute and install that single-file compiled app).

Self contained tutorial is here => https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli

In short, with .NET 6 you can do this:

dotnet build myproject.csproj -t net6.0 -RID win-x64 --self-contained

Notes:

benstaniford commented 1 year ago

That's really helpful, thank you again.

LanceMcCarthy commented 1 year ago

Okay, fixed the build 😎 => https://github.com/microsoft/github-actions-for-desktop-apps/actions/runs/3199140513

In your fork, GitHub will show you an easy rebase button that says "sync fork". That will pull in all the new commits I just added.

benstaniford commented 1 year ago

That's amazing, thanks so much for your efforts Lance, that's really helpful.