Posts

Azure DevOps: Deploy your SPA on AWS S3 bucket

Image
Introduction
According to Amazon's definition: Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.

These features make AWS S3 a really interesting candidate to store static files. However, since AWS S3 supports http static hosting, single page applications (SPA) can also get benefit from AWS S3.


Additionally, if you want to support https, you can also use AWS CloudFront. You can find more info in this article: https://aws.amazon.com/blogs/networking-and-content-delivery/amazon-s3-amazon-cloudfront-a-match-made-in-the-cloud/

 In a project were I'm working, I configured CI/CD to deploy a React application in AWS s3. Due to the poor quality of AWS documentation, even the most simple task can be challenge, so I will try to explain how to configure Azure DevOps to deploy to AWS S3, in case this can help somebody.

 Configuring Release Pipeline on Azure DevOps In order to work…

Azure Functions, the future of SaaS

Image
Introduction Recently, I have had the chance to use Azure Functions as candidate for the design and development of a service, which will be delivered as Software as a Service (SaaS). Azure Functions is a relatively recent technology, and as a consequence, I have realized many people didn't heard of it yet. For this reason, I would like to write this post as a brief introduction and my personal experience using it at the present.

What is Azure Functions? Azure Functions provide a framework to build and manage easily serverless oriented architectures. The idea behind Azure Functions  is that you have a piece of code, which provides a functionality. In order to execute your piece of code, Azure functions introduce the concept of "trigger". A trigger can be an HTTP request, a timer, a message in a queue, a modification on a Blog, etc. In addition, Azure Functions provides the concept of "bindings" Binding to a function is a way of declaratively connecting another…

Migrating legacy projects to .Net Core/Standard

Image
Introduction After the second version of .NET Core, it is pretty likely to be the future for .NET development, at least for many years. Luckily for legacy projects, Microsoft still continues supporting .NET Framework and developing new versions, such as .NET framework 4.8, which currently available as early access https://github.com/Microsoft/dotnet-framework-early-access. Even though, .NET Core provides some benefits that might be considered to port your legacy projects from .NET Framework to .NET Core. According to this article Choosing between .NET Core and .NET Framework for server apps, these are the points that you should consider to choose between .NET Core or .NET Framework:

Use .NET Core for your server application when:

You have cross-platform needs.You are targeting microservices.You are using Docker containers.You need high-performance and scalable systems.You need side-by-side .NET versions per application.

Use .NET Framework for your server application when:

Your app curren…

Script to clean your Visual Studio solution folder

Image
Sometimes, cleaning your solution folder comes in handy when you want to build from scratch. If you don't do so, you can have unexpected results because of the files generated by your previous builds.

To carried out the cleaning task, I use a simple script which allows me to configure a list of folders I want to remove. This script is divided in two parts. The first part is just a script to check if we have admin permissions. If not, it will display a pop-up to get admin permissions.


You can skip this part, but it is very handy, since the cleaning part might need admin permissions. This part can be very useful for all your scripts, which need admin permissions.

:: BatchGotAdmin :------------------------------------- REM  --> Check for permissions     IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system" ) ELSE ( >nul 2>&1 "%SYSTEMROOT%\system…

Why you should migrate your old csproj to SDK format

Image
Introduction  With the introduction of Visual Studio 2017, the format used for csproj was updated including several advantages. This new format will be used when you create a new .Net Core project or .Net Standard library. In spite of the fact that VS2017 continues supporting old csproj format, you can migrate your old projects to SDK format. As a result, you will have the following benefits:

Cleaner csproj files. With new format, a lot of things can be omitted, so your csproj files will be cleaner. Files are included using a wildcard, instead of including every single file. Solution project references are simplier.NuGet reference packages as PackageReferences, so you won't need packages.config and you will be able to use wildcard in your references (for example, 1.0.*).NuGet package definition as a part of the project file. You won't need more nuspec files.Definition of AssemblyInfo attributes in csproj, you won't need more AssemblyInfo.cs files. In addition, you will be…

Maintaining AssemblyInfo for multiple projects

Image
When you are developing an application or manly a NuGet package, you might want to keep the same AssemblyInfo for all your packages, which involves updating each project when you want to publish a new version of your package according to the SemVer convention Semantic Versioning 2.0.0 | Semantic Versioning.

In order to make it easier, with the improvements of dotnet core and the new csproj syntax, which I strongly recommend, MSBuild 15 introduced a pretty cool feature: Solution-wide project properties with Directory.Build.props Customize your build - Visual Studio | Microsoft Docs. Basically, this allows you to define certain properties and use them in all your project in a centralised way, so you don't have to update your projects one by one.

All you have to do is create a new text file named Directory.Build.props and place it where you have your solution file. Here is an example of the properties you can use:

‍<Project>
  <PropertyGroup>
    <Version>1.1.0</Ve…

Use Visual Studio extension to distribute your Code Snippets

Image
Introduction In a previous post we saw how you can build code snippets to write tests faster empowering your team to follow good practices. https://www.albertocorrales.com/2018/10/writing-unit-tests-faster.html

In this post, we will see how we can distribute our snippets with a Visual Studio extension, which offers different advantages, for example:
You encapsulate your snippets in a VS extension, you you don't need to distribute them independently, and developers don't need to add them to VS one by one. The extension can be updated improving he current snippets or including new snippets.You can add more functionality in your Visual Studio extension.  Creating a new Visual Studio extension First of all, if you have never developed a Visual Studio extension, you might need to install Visual Studio extension development kit. To do it, install this option in your Visual Studio Installer



Create a new Visual Studio extensions project. For this example, I will name it "Snippets…