Category Archives

2 Articles
Dotnet core 2 Angular 5 : Error “app.browser.module.ngfactory” while publishing

Dotnet core 2 Angular 5 : Error “app.browser.module.ngfactory” while publishing

This article talks about ” Can’t resolve ‘./../$$_gendir/ClientApp/app/app.browser.module.ngfactory'” error while publishing a dot net core 3, angular 5 application created from SPA template and how to fix it.
When I was building my aspnet core web applciation, I got following errors in my Gitlab CI pipeline, in this article, we will try to resolve them.

  • Module not found : error : Can’t resolve ‘./../$$_gendir/ClientApp/app/app.browser.module.ngfactory’
  • error MSB3073: The command “node node_modules/webpack/bin/webpack.js –env.prod” exited with code 2.

My setup

@angular/cli - Version 1.5.5
Node: Version 8.2.1
npm: Version 5.5.1
dotnet code: Version 2.1.1-preview-007165

Step 1: Create a new Dotnet core 2 Angular application from SPA

Run following commands in a shell

mkdir ng5-app
cd ng5-app
dotnet new angular
npm install

Step 2. Verify the angular version and upgrade to angular 5

At the command prompt, run following command to install a utility to check outdated packages (Note: to run these commands, you should have npm installrun as explained in step 1).
Read More

How to check if an object is null in C#?

How to check if an object is null in C#?

Usual methods to check a type is null will result in Null reference exception if an object is checked for null. This post compiles all good and bad methods.

Following methods of checking if an object is null will result in a NullreferenceException.

Wrong method #1

object simpleObject = null;
If(string.IsNullOrEmpty(simpleObject.toString())
{
 // do something if object is null
}
else
{
 //do somethingif object is not null
}

Wrong method #2

Read More