How to use GitHub Actions for .Net Framework?

Поделиться
HTML-код
  • Опубликовано: 22 мар 2020
  • Let's build a GitHub Actions CI for a Full .Net Framework application.
    GitHub Actions has many Starter Template for a lot of different languages, such as .Net Core, Python, Java, Docker, and many more. But unfortunately there is no out of the box Starter Template for the Full .Net Framework.
    So it's time for us to see how we can setup Actions to do Continuous Integration for a .Net Framework project.
    🌟EXCLUSIVE CONTENT🌟
    Do you want to access exclusive content, live chats and Q&As, polls, and even 1:1 calls with me? Join my Patreon: / coderdave
    🆘 NEED HELP? 🆘
    Book a 1:1 Consultation with CoderDave: geni.us/cdconsult
    🙏🏻SUPPORT THE CHANNEL🙏🏻
    Buy me a coffee: www.buymeacoffee.com/CoderDave
    PayPal me donation: paypal.me/dabenveg
    💬JOIN THE COMMUNITY
    ► Website: coderdave.io
    ► Discord: geni.us/cddiscord
    ► Newsletter: coderdave.io/newsletter
    ► Blog: dev.to/n3wt0n
    ► GitHub: github.com/n3wt0n
    ► Twitter: / davidebenvegnu
    ► Facebook: / coderdaveyt
    🎥VIDEOS
    ► Automate EVERYTHING with GitHub Actions: • Automate EVERYTHING wi...
    ► Azure DevOps vs GitHub: • GitHub vs Azure DevOps...
    📄RESOURCES
    ► GitHub Actions docs: help.github.com/en/actions
    ► BugGuardian: github.com/n3wt0n/BugGuardian
    ► BugGuardian.MVC: github.com/n3wt0n/BugGuardian...
    🎤PODCAST: geni.us/cdpodcast
    ❓QUESTIONS?
    Have a question about DevOps, Cloud, Coding, or Anything Else? Post in comments section of this video!
    🔴SUBSCRIBE to CoderDave here: ruclips.net/user/CoderDave?sub...
    _______________
    👕GET MY MERCH: geni.us/cdmerch
    🔮TOOLS I USE
    ► Twingate - Connect to your Private Resources SECURELY: geni.us/twingate
    ► TubeBuddy - #1 RUclips channel Management tool (FREE): www.tubebuddy.com/CoderDave
    ► Moosend - Free Newsletter and Automation Platform: geni.us/moosend
    📸🖥️GEAR AND SOFTWARE
    ► Music - Epidemic Sound (Get 30 days free): epidemicsound.com/referral/zf...
    ► Editing - Adobe Premiere Pro: geni.us/AdobeVideo
    ► Gear I Use for RUclips: kit.co/CoderDave/gear-i-use-f...
    ► Gear I Use for Streaming: kit.co/CoderDave/gear-i-use-f...
    ► My Computer Setup: kit.co/CoderDave/main-compute...
    ► Full office setup: github.com/n3wt0n/work-from-h...
    Disclaimer:
    Some product links are affiliate links which means if you buy something Il receive a small commission at no additional cost to you.
    As an Amazon Associate, I earn from qualifying purchases.
  • НаукаНаука

Комментарии • 47

  • @ItalanFindart
    @ItalanFindart 4 года назад +2

    Thank you. Great explanation.

    • @CoderDave
      @CoderDave  4 года назад +1

      Thanks for watching. It’s a “niche” area for GitHub Actions but I thought it’s worth sharing

  • @vkarasik
    @vkarasik Год назад +1

    Many thanks - you saved my day!

  • @mostefakamallala9972
    @mostefakamallala9972 3 года назад +1

    Thank you. great video!

  • @russellboley1994
    @russellboley1994 3 года назад +6

    Great video! Would be great to have a video showing how to add the unit tests, and publishing to github packages. thanks! :)

    • @CoderDave
      @CoderDave  3 года назад +3

      Thanks! 😊 stay tuned because il have something on this topic soon 😉

  • @guitarbits17
    @guitarbits17 Год назад

    It was really excellent 👍🏻👍🏻

    • @CoderDave
      @CoderDave  Год назад

      Thanks! Happy to know it was helpful

  • @ivanmoragasalvador814
    @ivanmoragasalvador814 2 года назад

    Hi bros, i have a problem with this, the nuget restore .sln cannot be found vvproj reference, any solution?

  • @punithcs1
    @punithcs1 Год назад +1

    Thanks for the Video, I'm working on CICD for .net webservice on .net framework 3.5 . Stuck in publishing\deploy part of the same. Have a video on CD part ?

    • @CoderDave
      @CoderDave  Год назад

      I don't think I have a video on that specifically, what problem are you encountering?

  • @razubd5258
    @razubd5258 4 года назад +1

    wow very good boss this video

  • @thomasbarratt5333
    @thomasbarratt5333 3 года назад

    Hi Dave and thanks for the video. Very helpful and it's a shame we still don't have templated for .Net Framework. Are you aware of a way to run our unit tests, in particular xUnit?

    • @CoderDave
      @CoderDave  3 года назад +2

      Hi Thomas, yes I agree with you :) Would love to see more love for the .Net Framework.
      About xUnit, I haven't used it with Actions but it should just run (famous last words...). After building the app, you should be able to run the test using the VSTect.Console.exe CLI (docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2019)
      If you wanna see the test results, you can also use the xUnit Viewer action: github.com/marketplace/actions/xunit-viewer
      Let me know if this works, I don't have xUnit tests to try this with :)
      PS: Feel free to join our Discord Server for more info and support ;) discord.gg/sJFmYC9TXb

    • @tpbarratt
      @tpbarratt 2 года назад +1

      @@CoderDave Hi Dave, thanks for the response and suggestions. I've got it all working now with a workflow, for an open source serial communication library I'm working on at the moment. I'm using xunit's msbuild extension - feel free to have a look! github.com/thomaspb88/BronkhorstProParSerialCommunication/blob/master/.github/workflows/CI.yml. The test results are output to the repo's root.

    • @CoderDave
      @CoderDave  2 года назад +1

      That looks pretty good. One thing I'd change is publishing the test results as artifact of the build, so you have it there (if not you don't necessarily know to what build that test result belongs to)

  • @balkishan2k11
    @balkishan2k11 2 года назад +2

    Awesome dave. But I'm facing one issue that is I have a server machine which doesn't have ms build and vs where. It asks couldn't find msbuild

    • @CoderDave
      @CoderDave  2 года назад +1

      I assume you are talking about your own build server. I’m that case, you’d need to install all the required components (vs or msbuild) on it before you can do it…
      If you use the hosted runners, instead, everything should already be installed on the Windows runners (make sure you’re not doing it on Linux runners), and make sure to use the setup msbuild step I have in the beginning of the workflow

    • @balkishan2k11
      @balkishan2k11 2 года назад +1

      @@CoderDave Thank you for your confirmation and it make sense to install on server. Another query is it mandatory to have visual studio installed in our server machines? Does the ms build.exe and vswhere.exe can be configured in github actions yml file. If yes can we have the demo if not the code snippet. If no then manual installation is the only option left i believe. Thank you in advance

  • @gringo533
    @gringo533 2 года назад +1

    Great video! However, I am struggling to setup the runner to build my project targeting .NET Framework 4.0. It seems the runners do not have this component installed. Any idea on how to get this running?

    • @CoderDave
      @CoderDave  2 года назад

      Thanks. It's been a while that I haven't tried with .NetFX 4... but if it is not installed, the only option you have is to add a task before the build which downloads it and installs it

    • @CoderDave
      @CoderDave  2 года назад

      But I've just checked, and .Net Framework 4.5, 4.6 and 4.8 are installed by default on the hosted runners... so it should work
      You can check what is installed on the hosted runners on the page here: docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software

    • @ABHISHEKPATHAK49
      @ABHISHEKPATHAK49 Год назад

      @@CoderDave I tried with the .Net 4.8 version but the pipeline does not work. Any working example. I am using windows-2016

    • @CoderDave
      @CoderDave  Год назад

      Hi. Any specific error you’re encountering? Perhaps you can joy our discord server and we can discuss there (easier 😁)

    • @hanieharabzadeh4185
      @hanieharabzadeh4185 Год назад

      @@CoderDave can you help me what's the yaml step for downloading .net framework 4.8. I couldn't find any good example online

  • @chackokabraham738
    @chackokabraham738 2 года назад +2

    Hi Dave,
    What if i have multiple projects under one repo and then each project(Folder) contains a solutions file ? Any thoughts on that ?

    • @CoderDave
      @CoderDave  2 года назад +2

      Hey. What I would do is having multiple jobs in the workflow, one for each solution, so you can build independently and in parallel all your solutions :)
      Or, if you want to build only the project that has changed, I take the same approach (multiple jobs in the same workflow) and then have a conditional in each job based on the folder that triggered the run (you can use the event data for that).

    • @chackokabraham738
      @chackokabraham738 2 года назад +2

      @@CoderDave so conditions meaning, i believe you are talking of checking a regex pattern at Msbuild Run command. I was checking for links where i can understand regex patterns in github actions. Did you find any place where i can get regex patterns for actions. Well your option is also a good idea. Just checking.

    • @CoderDave
      @CoderDave  2 года назад +2

      No, not conditions for MSBuild. Conditions in GitHub Actions. You can "decide" if run a job or not based on conditions. (docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif)
      Let's say you have 2 projects, A and B, in 2 folders: fA and fB.
      You create 2 jobs, JobA and JobB, that respectively build project A and B.
      You want JobA to run only is anything changed in the folder fA, and JobB only for changes in fB.
      You should be able to add an "if" to the Jobs and check that condition using the data from the GitHub triggering event

    • @chackokabraham738
      @chackokabraham738 2 года назад +1

      @@CoderDave Thank you so much that really helped :)

    • @CoderDave
      @CoderDave  2 года назад +1

      No problem at all ☺️

  • @evilroxxx
    @evilroxxx 21 день назад +1

    Where do you save the environment based web.config files? Are they transformed as part of the build pipeline process and deployed along with the build? Can you shed some light on that? 🙏

    • @CoderDave
      @CoderDave  20 дней назад

      well that really depends on your process. but yes, if you use the web config transformation, that can be done as part of theci process and then deployed

    • @evilroxxx
      @evilroxxx 20 дней назад +1

      But that means we must store the config on GitHub. Isn’t that a security risk? Is this the only way or there’s a better way to manage config as part of CI/CD?

    • @CoderDave
      @CoderDave  20 дней назад

      Yes. You can save the config files in git but of course without the secrets 😄
      One way to do it is for example to tokenize the config file and then at build time replace the tokens with the actual secrets, before deploying. In this way you can save the secrets in GitHub actions secrets or, better, in a vault like Azure KeyVault and retrieve them only when you need to replace the tokens

    • @evilroxxx
      @evilroxxx 20 дней назад

      @@CoderDave interesting solution. Do you mind demonstrating this in a future video? I’ve never come across any video handling this real life scenario. Most of the videos I see are vanilla. Would be really great for your profile views 😜
      Thank you so much for helping the community. 🙏🫡

  • @JigarSangoi1990
    @JigarSangoi1990 3 года назад +2

    How to do Continuous deployment on multiple vps with pipeline ?

    • @CoderDave
      @CoderDave  3 года назад +2

      Hi. It depends on your scenarios, but I would say you probably want to use Environments for VMs for that. I have a video on this coming out this Tuesday! :)

    • @JigarSangoi1990
      @JigarSangoi1990 3 года назад

      @@CoderDave Thanks for it.

  • @davidewan3
    @davidewan3 Год назад

    My C# project is based on the .NET Framework 4.6.1. I want to use Code Coverage as a step in my CI/CD but that has a min requirement of 4.7.2. There is no way of installing 4.7.2 standalone unless you can think of one. I can upgrade my project.

    • @CoderDave
      @CoderDave  Год назад

      I think you can't do that... CodeCoverage requires 4.7.2, as you said. but it also requires the application to run on 4.7.2

  • @ahmedazouz303
    @ahmedazouz303 8 месяцев назад

    I'm facing a problem while publishing the deployed files on Github using yml file because the files didn't copied to the the new folder
    name: Build then Publish to Folder
    run: MSBuild App.sln /p:Configuration=Release /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=_build

    • @CoderDave
      @CoderDave  8 месяцев назад

      Not sure what you mean. What file is not copied to the new folder?

    • @davidb3925
      @davidb3925 6 месяцев назад

      @@CoderDave Probably the executable.