This project demonstrates how to deploy a .NET Web API application to Microsoft Azure using Terraform for infrastructure provisioning and GitHub Actions for CI/CD, providing an end-to-end example setup. https://github.com/kaajoj/iac-azure-dotnet-api-deploy
Category Archives: C#
.NET MAUI – app to add expenses quickly
I recently created an application in .NET MAUI that is now available for download. I made it for myself to be able to add costs in a very fast way. I will probably add some functionalities, improve the appearance and possible bugs. Feel free to use. Link to Google Play: https://play.google.com/store/apps/details?id=com.companyname.fastcost Screenshots: Some short vids:
.NET MAUI – fix ‘failed processing manifest’ AndroidManifest.xml
The .NET MAUI application. I had the following errors when launch the application: Error APT2067: failed processing manifest. 0 Error APT2260: resource mipmap/appicon (aka com.companyname.fastcost:mipmap/appicon) not found. This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file. 0 Error APT2260: resource mipmap/appicon_roundContinue reading “.NET MAUI – fix ‘failed processing manifest’ AndroidManifest.xml”
AutoFixture ThrowingRecursionBehavior fix
To fix error in tests add followings lines of code. Example in xUnit:
Using the OpenAI API in a C# console application
Repo: https://github.com/kaajoj/OpenAIApp To run it, you need to provide your own API key. Sample code with request to generate new image: https://github.com/kaajoj/OpenAIApp/blob/cc1881a985365683c90484e9cb2dca7c1361b810/OpenAIApp/OpenAI.cs#L52 Sample results of image generation: Big dogs flying a plane to Mars Dogs like top gun
New console template – use user secret
dotnet user-secrets init set a secret: dotnet user-secrets set “API_KEY” “test123” use UserSecretsId (from .csproj file) in AddUserSecrets()
Mock IConfigurate in xUnit
If you want mock IConfiguration use following code: or copy secrets.json configuration file to output directory: projectName\bin\Debug\netcoreapp3.1 and then use following code in ContextFixture: Config json file e.g. secrets.json:
Secret storage in .NET
Enable secret storage:Type “dotnet user-secrets init” into Package Manager Console <UserSecretsId> can be found in .csproj file. Set a secret (Package Manager Console):dotnet user-secrets set “ApiKey” “test123” or to remove it:dotnet user-secrets remove “ApiKey” To check if exists:dotnet user-secrets listorManage secret through GUI -> right click on project -> Manage User Secrets -> it opensContinue reading “Secret storage in .NET”
The term ‘dotnet-ef’ is not recognized – Entity Framework error
Quick post about fixing Entity Framework, probably common error when you want to use ef for the first time e.g. you installed Visual Studio on new pc, fresh os, new project etc. and want to make dotnet-ef migrations or database update. Error message:“dotnet-ef : The term ‘dotnet-ef’ is not recognized as the name of aContinue reading “The term ‘dotnet-ef’ is not recognized – Entity Framework error”
Scaffolding in .NET Core (generate API controllers – CRUD (or MVC controller with views in necessary)
Right click on ‘Controllers’ folder –> Add –> New Scaffolded Item… For api controller without views select ‘API Controller with actions, using Entity Framework’ and click ‘Add’.If MVC then choose ‘MVC Controller with views, using using Entity Framework’ On next view select your model (you need create model before generate code) and select data contextContinue reading “Scaffolding in .NET Core (generate API controllers – CRUD (or MVC controller with views in necessary)”