If you’re not already subscribed to Steve Smith’s Dev tips mailing list, I highly recommend signing up for it here. He provides awesome quick tips. Today’s tip was around custom exception handling which can be found here. Making this small change to your exception handling has definitely saved me from headaches while debugging.
I first saw this on Scott Hanselman’s blog the other day and wanted to share the tip. Additional details can be found from his blog here. Please note that this feature is only available on Visual Studio 2015 Update 3 and up.
Steps to Enable:
1. Launch Visual Studio 2017
2. Select Tools > Options
3. Select Text Editor > C# > Advanced
Now Visual Studio will give you an additional choice when you try and use a type that doesn’t exist to use a NuGet package that has that defined type. Awesome!
Some may note that this feature has been in Resharper for awhile now but seeing this integrated into the default IDE is a huge plus.
I came across this cool infographic today from a local user group mailing list and figured I’d share here. It lists some of the new features and improvements in VS2017 as well as some other misc bits of information like some basic git commands. Enjoy!
There’s a ton of great resources out there for learning about programming from basic syntax to more advanced topics like design patterns. There’s plenty of great YouTube videos or blog posts out there but I wanted to compile a list of professional learning resources that I’ve personally used. Spoiler: Pluralsight is my favorite resource for .Net development and their lineup of authors is amazing. Pluralsight has been acquiring other learning resources and adding more content outside of Microsoft focused courses which has been great and making the monthly subscription even more valuable.
- Microsoft Virtual Academy
If you ever run into a scenario where you need to run your TeamCity build configuration step against a particular build agent there is a simple solution for you built right into TeamCity.
1. Navigate to your build configuration step by either selecting it from the Overview page or selecting your project, and then the build configuration step.
2. Select “Edit Configuration Settings” at the top-right of the page.
3. Select “Agent Requirements” from the left-hand side of the page.
4. Underneath the “Explicit Requirements” section, select “Add new requirement”.
5. Select the parameter name “teamcity.agent.name”.
6. Use the default condition of “equals”.
7. Within the value field, add the name of your TeamCity build agent that you would like your process to run against.
Note: These steps are based on TeamCity 9 but have been verified to still work with the latest version of TeamCity 10.
I saw this video series in a newsletter from freecodecamp the other day. It’s a great general overview of Git and GitHub that doesn’t get stuck in the details. I know when I was first being introduced to Git and interacting with the GitHub repository service it was a bit confusing keeping all the terminology in mind. This is a really clear and simple series that I’d recommend.
The above command is something I used on a project recently as a shortcut to stage and commit the file within the same command. Cool! That saves me from running an extra command. Before, I would stage and track all the files that I’ve been working on with the following:
git add .
followed by the actual commit itself for the staged changes made:
git commit -m "Added new file"
I tried this new found shortcut recently in a similar scenario but was surprised to see that it failed. Huh? I’ve done this before, I changed a file and then was able to combine the command to both stage and commit it at once. The key here (if you believe my commit message) is that in this scenario we have added a new file. This is a file that hasn’t been tracked before so git isn’t aware of it. Git even points this out to us right after we try and execute the command for a file that has never been tracked before.
We’ll have to specify that this file should be tracked and staged by using the command
git add Test.rtf and then commit the file with
git commit -m "Added new file".
Now, if we modify the contents of the Test.rtf file for any future changes we can use the add and commit combined command.
This is because I didn’t have a clear understanding of what
git commit -a would do. When adding the -a flag to
git commit this instructs Git to automatically stage every file that is already tracked before doing the commit. While
git add filename both tracks and stages the file specified.