project.assets.json’ not found. Run a NuGet package restore to generate this file.


I was getting this exception while building my blazor application.

project.assets.json’ not found. Run a NuGet package restore to generate this file.

I fixed this issue by clearing NuGet Caches. I hope this will help to other developer.

Advertisement

The instance of entity type ‘XXXX’ cannot be tracked because another instance with the same key value for {‘XXXX’} is already being tracked.


While working my EF core Application I was getting this exception message. I fixed this issue like this

Step 1: In Insert/update method make ensure to detach the entity.

_db.Entry(localRopFiles).State = EntityState.Detached;

Step 2: If you are loading data on page load then use AsNoTracking() method

var query = await _db.LocalRopFiles.AsNoTracking().ToListAsync();

I hope this will help some one who is getting this type of exception.

npm install -g @angular/cli is not working


Recently while working with angular 5 project my angular/cli was corrupted. I was trying to repair the CLI by re-installing like this

npm install -g @angular/cli

But it was not installing the cli.

I fixed the problem like this

Step 1: Go to visual studio terminal and type the command like this
npm uninstall -g angular-cli

Step 2: Clear the cache using this command
npm cache clear –force

Step 3: Remove the roaming folder from this location
a. C:\Users\\AppData\Roaming\npm\
b. C:\Users\\AppData\Roaming\npm-cache

Step 4: Install the latest cli like this

npm install -g @angular/cli@latest

I hope this will help to some one.

Why is OpenSubKey() returning null on my 64-bit system?


Today i was debugging the code, it was written like this


 string _retValue = "";
            Microsoft.Win32.RegistryKey _rKey;
            Object _rKeyObject;
            string REG_KEY_PATH_PROFILE = "SOFTWARE\\Wow6432Node\\Mycompany\\e-business\\Platform\\profile\\";
            try
            {
                _rKey = Microsoft.Win32.Registry.LocalMachine;
                _rKeyObject = _rKey.OpenSubKey(REG_KEY_PATH_PROFILE).GetValue(keyName);
                _retValue = Convert.ToString(_rKeyObject);
                return _retValue;
            }

It was returning null value every time, then i came to know i am building the application on 64 bit, To make the work around we can change project setup like this given below

Unable to access the IIS metabase


Hi

Today while working on one of my project, i was getting exception like given below.

Unable to access the IIS metabase.You do not have sufficient privilege to access IIS web sites on your machine

metadata_error

I found the two possible approach to fix this issue

1. Run the visual studio as “administrator Mode”

2. Permanently grant the IIS Metabase folder permissions to the current user.

First approach is straight forward, while for the second approach we have to go the given path

%systemroot%\System32\inetsrv\config

For this we have to do Win + E then Paste the given path in top address bar.

You will get the window like this

access

You click on “Continue” button. Now reload the project from Visual you will not get the above exception.