Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Tuesday, May 31, 2022

Build and deploy .net framework / .net core to IIS with Gitlab and some awesome templates

In this blog I'll explain the way we do our builds with gitlab. It took some time to get to this, so I'm happy to share it with you. At first we set the ground-rules:
  1. You use GitLab
  2. You have GitLab runners on windows machines on powershell (core)
  3. Make use of merge requests to merge code changes to the default branch
  4. Create release tags in the form of semver '1.0.0'
  5. The default branch always gets deployed to your development IIS server
  6. After creating a release in GitLab, a production build is generated
  7. Manual trigger starts the deployment to your production IIS server
  8. There is a solution file in the root of the project
  9. There is only 1 deployable webproject in your solution
  10. The dotnet-* templates reside in a shared repository
Challenges we faced we're especially with the msdeploy command which behaves really funky under powershell (I dare you to do a duckduckgo search on this and see what you'll find). I really like the way everything is parameterized, so the core just works, but if you need a bit more, you just adjust where needed without breaking all the defaults in the build an deploy pipelines. This makes maintaining them a lot easier when environments change and forces you to use a standardized way of work. 

I also like the validation of the release tag numbering using the .pre step validate_tag job. It only runs when a tag is set and it's not in the form of a semver. You can never build a production packages without a proper number.

The .gitlab.yml is the ci file for your end project, it sets urls and can customize some configuration. The dotnet-framework.v1.gitlab-ci.yml and dotnet-core.v1.gitlab-ci.yml files are the base templates you can inherit in the .gitlab-ci.yml. 

Below are all the gists needed to get you going or just to get inspired. If you have any feedback, I'm happy to learn about your experiences. Comment on the gist or this blog!

Happy deploying,
Luuk

Wednesday, October 7, 2015

Tail with cmder (or powershell)

With powershell it's really easy to tail log files. But to make it even easier, I've added a Tail with Powershell context menu in windows. Just save the next lines as a .reg file and run it.


Btw, mine is called 'Tail with cmder' just because cmder is awesome!

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Tail with cmder\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Get-Content -Wait -Tail 10 '%1'"

Cheers,
Luuk