Tuesday, September 22, 2020

How to integrate Angular 9 with an ASP.NET Core Project

The best article for updating angular to the latest version(yes it work and for Angular 10).

I had issue after update from Angular 8(from Microsoft template) to 9 and 10, by the way this issue with one string "ng serve --verbose"

Sometimes this brings more happiness:  ' "start": "echo Starting... && ng serve" '

Thursday, September 10, 2020

Steeltoe

I liked this project and the ideas it offers

    Steeltoe makes programming .NET quicker, easier, and safer for everybody. Steeltoe’s focus on speed, simplicity, and productivity has made it one of the world's most popular .NET frameworks.

    Steeltoe makes building web applications fast and hassle-free. By removing much of the boilerplate code and configuration associated with web development, you get a modern web programming model that streamlines the development of server-side HTML applications, REST APIs, and bidirectional, event-based systems. 

Steeltoe is proven
Steeltoe’s libraries are trusted by developers all over the world. Steeltoe delivers delightful experiences to millions of end-users every day. Steeltoe also has contributions from development teams at Microsoft, and more.
Steeltoe is flexible
Steeltoe’s flexible and comprehensive set of extensions and third-party libraries let developers build almost any web application imaginable. At its core, Steeltoe Framework’s features provide the foundation for a wide-ranging set of features and functionality. Whether you’re building secure, cloud-based microservices for the web, or complex streaming data flows for the enterprise, Steeltoe has the tools to help.
Steeltoe is productive
Steeltoe transforms how you approach .NET programming tasks, radically streamlining your experience. To go even faster, you can use Steeltoe with Spring Cloud’s rich set of supporting libraries, servers, patterns, and templates, to safely deploy entire microservices-based architectures into the cloud, in record time.
Steeltoe is fast
Developer productivity is one of Steeltoe’s superpowers. Steeltoe helps developers build applications with ease and with far less toil than other competing paradigms. You can even start a new Steeltoe project in seconds, with the Steeltoe Initializr at start.Steeltoe.io
Steeltoe is secure
Steeltoe has a proven track record of remediating security issues quickly and responsibly. The Steeltoe committers work with security professionals to patch and test any reported vulnerabilities. Third-party dependencies are also monitored closely, and regular updates are issued to help keep your data and applications as safe as possible. In addition, Steeltoe Security makes it easier for you to integrate with industry-standard security schemes and deliver trustworthy solutions that are secure by default.
Steeltoe is supportive
The Steeltoe community is global, diverse, and spans folks of all ages and capabilities, from complete beginners to seasoned pros. No matter where you are on your journey, you can find the support and resources you need to get you to the next level: quickstarts, guides & tutorials, videos, support, or even formal training and certification.

Secrets of a .NET Professional

Secrets of a .NET Professional 
Briefly on the topic
  1. The common language runtime conserves string storage by maintaining a table, called the intern pool, that contains a single reference to each unique literal string declared or created programmatically in your program.
  2. Reading more code makes us better developers.
  3. Nothing is free, and it always costs us something.
  4. Task.Awesome
  5. Learn LINQ
  6. Take It Easy On The Patterns
  7. One Project Is Fine*
  8. one good integration test is worth 1,000 unit tests
  9. Use Tools Other Than .NET
  10. A cohesive team with dated technology will outperform a dysfunctional team with the latest tech every time

Best way to create an empty collection (array and list) in C# (.NET)

very helpful article on initializing arrays and lists
For array will be the best - new TestArray[] { }
For list - new List()

Wednesday, April 15, 2020

Cool highlighter for many languages and tools

I like it

windows container in docker

One of my tasks is to run Windows containers in docker.
Also, need to manage IIS.
I took part of the code here

The Dockerfile install aspnet windows container with 4.6.2 (because I using old code in my projects), enable in container IIS remote management and binding 443 port with SSL certificate
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.6.2
ARG source
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Install-WindowsFeature -Name Web-Mgmt-Service
RUN New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1 -Force
#RUN New-NetFirewallRule -Action Allow -Direction Inbound -DisplayName IISManagement -Service WMSVC
RUN set-service -Name WMSVC -StartupType Automatic
RUN Get-Service -Name WMSVC | Start-Service
RUN net user admin 6H%*!k0*/I /ADD
RUN net localgroup administrators admin /add
#RUN New-WebBinding -Name 'Default Web Site' -IP '*' -Port 443 -Protocol https
RUN $newCert=New-SelfSignedCertificate -DnsName 'localhost' -CertStoreLocation cert:\LocalMachine\My; \
  New-WebBinding -Name 'Default Web Site' -Protocol 'https'; \
  $binding=Get-WebBinding -Name 'Default Web Site' -Protocol 'https'; \
  $binding.AddSslCertificate($newCert.GetCertHashString(),'my')
EXPOSE 80 443
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

Thursday, February 20, 2020

GitInfo. How using versioning from Git Tag and C# projects (frameworks and core)

In all big or small companies, you might be using versioning, I recommend using GitInfo, because it is a simple project that will help you be more advance.

A huge plus of GitInfo project is that besides the library itself you don’t need anything else


For dotnet core projects, I enable support Git and make the first commit and after I add Git Tag "0.1.0".

Then I add NuGet package "GitInfo"

Next step you need to add AssemblyInfo.cs, better to Properties folder

using System.Reflection;

[assembly: AssemblyVersion (ThisAssembly.Git.BaseVersion.Major + "." + ThisAssembly.Git.BaseVersion.Minor + "." + ThisAssembly.Git.BaseVersion.Patch)]

[assembly: AssemblyFileVersion (ThisAssembly.Git.SemVer.Major + "." + ThisAssembly.Git.SemVer.Minor + "." + ThisAssembly.Git.SemVer.Patch)]

[assembly: AssemblyInformationalVersion (
    ThisAssembly.Git.SemVer.Major + "." + 
    ThisAssembly.Git.SemVer.Minor + "." + 
    ThisAssembly.Git.Commits + "-" + 
    ThisAssembly.Git.Branch + "+" + 
    ThisAssembly.Git.Commit)]




And last step change csproj, you need add 3 rows

<PropertyGroup>
        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    </PropertyGroup>

After that, you can use GitInfo and versioning anywhere

Good luck!!!