Category: Visual Studio

Resharper – My most used shortcuts

Ctrl + T – Find anything in Visual Studio Solution

Fastest way to find files in your visual studio solution. Press this shortcut and start typing the keyword to navigate to your desired file.

Ctrl E + C – Code Cleanup

Re-sharper allows to clean code based on the defined tasks. Configure the tasks for C#, Html , CSS, Javascript etc. and follow the action after pressing this shortcut.

Ctrl R + R – Rename

The Rename refactoring allows you to rename any symbol, including: namespaces, types, methods, parameters, local variables, properties, fields, and events. It automatically finds and corrects all references to the symbol. The Rename refactoring can be invoked directly from the editor and sometimes from other views (Class View, Object Browser).

Ctrl + Alt + D – Todo explorer

Although nobody likes tech debt but there are instances when on an agile projects few tasks are to be pushed back to the future sprint. In such cases a TODO comments are applied. Re-sharper gives a feature to view such TODO items and a best practice its good to fix the TODO items before a production code is ready. Please this shortcut to view all the TODO items in your solution/project

Alt + Enter + Enter

Shortcut helps to rename the file same as the class name. These instances might come after the file (e.g.: .cs) is created and you decide to change the

 

Visual Studio 2019 preview

Visual Studio 2019 preview been out, changes that comes are-

  1. Start window
  2. UI refresh
  3. Search improvements
  4. Code cleanup
  5. Debugger Search

Start Window

A refreshed start window allows quickly to clone or checkout code or open a project or solution. Open a local folder and create a new project. Are able to open a most recent projects. Microsoft call this as “Start Window Experience” which allows developers to start quickly.

vs1

UI refresh – Create New project dialog

Devs are now able to search the project templates quickly and filter as per language, platform and project type.

vs2

Search improvements

Search bar is right at the top after the menus. Allows to search items very instantly provides suggestions if anything can be searched online.vs3

Code clean up

Now have a code clean up option can be configured to include fixers and clean up code if for any warnings or errors.

vs4

vs5

You may change the direction of rule- Tools > Options > Text Editor >  Code Style.

 

nuget restore: Exception has been thrown by the target of an invocation

I am working on Sitecore 8.2 Helix based architecture. whilst doing a build received error –
MSBuild auto-detection: using msbuild version ‘14.0’ from ‘C:\Program Files (x86)\MSBuild\14.0\bin’
Error parsing solution file… Exception has been thrown by the target of an invocation.

Was able to resolve this issue suppose while merging changes the solution was missing the End Project

Project(…)
EndProject
Project(…)

Project(…)
EndProject

After adding the “EndProject”  was able to parse the solution and build.

mongodb as a service

Download and Install Mongo db for your OS from https://www.mongodb.com/download-center#community

Created a folder to store the collected data in mongodb e.g.:- C:Path\mongodb

Create a log folder in mongodb folder and create mongodb.log file.

Execute the below in command from the path where mongo is installed or set the global variables to execute this command.Update the path accordingly

mongod --dbpath "C:\Path\mongodb" --serviceName "LocalMongoDB" --logpath "C:\Path\mongodb\log\mongodb.log" --logappend --install

You should see in you serives (run services.msc) mongo service which will be in stopped state. Start the mongo db service.You may start monngodb from command prompt. For more details see this -https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/