Skip to main content

Posts

Showing posts from June, 2020

How to clear Visual Studio Cache

How to clear visual studio cache Many times, during development you would face situations where project references are not loaded properly or you get missing/error DLL's. This is because the Component cache gets corrupted randomly and without any warnings. The first option that needs to be done is to clear component cache and restart Visual Studio since the Cache might be holding onto previous DLL versions. Here are the steps on how to clear Visual Studio Cache, Clearing Component Cache: Close all Visual Studio Instances running in your machine. Also, make sure devenv.exe is not running in the Task Manager Delete the Component cache directory - %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\1x.0\ComponentModelCache Restart Visual Studio The above steps should fix the cache issue most of the times, but some times that is not enough and you need to perform the below steps as well. Clearing User's Temp Folder: Open the temp folder in this locatio n -  %USERPROFILE%\AppData\Loc

Error NU1605 - Detected package downgrade. Reference the package directly from the project to select a different version.

Error NU1605 - Detected package downgrade This error occurs when a dependency package has a version higher than an existing package version in the project solution. Solution: Add the following in .csproj file < PackageReference > < NoWarn >$( NoWarn ); NU1605 </ NoWarn > </ PackageReference > Another way to do this is to right-click on the solution and  click  Properties . Click  Build  and under  Errors and warnings  add 1605 to the  SuppressWarnings  text box. You can also add multiple error codes that you want to suppress by adding each separated by a comma. P.S. The below screenshot is in VS2019 Mac Version

Calling REST APIs in PowerShell

PowerShell - REST API Many times we would require pulling web-based information into PowerShell. There are two ways to do that in PowerShell.  Invoke-WebRequest Invoke-RestMethod Invoke-WebRequest : This command can be used to get content from a web page. The cmdlet sends HTTP calls to a web page or a web server. Using Basic Authentication: $creds = [ System.Convert ]::ToBase64String([ System.Text.Encoding ]::UTF8.GetBytes( 'username:password' )) Invoke-WebRequest -URI '<path>' -Method 'POST' -ContentType 'application/json; charset=utf-8' -Headers @ { 'Accept' = 'application/json' ; 'Sample-Header' = 'Test' } -Authentication @ { 'Authorization' = 'Basic ' + $creds } Using a Client Certificate: Invoke-WebRequest -URI '<path>' -Method 'POST' -ContentType 'application/json; charset=utf-8' -Headers @ { 'Accept' = '