Keeping track of interesting places I put my feet on in the software development world.
Search This Blog
Sunday, March 27, 2022
Monday, August 31, 2020
Creating Unit Test Fact method code snippet in Visual Studio
Save the following xml file with the .snippet extension.
Afterwards, load it into the Code Snippet Manager in Visual Studio via
Tools -> Code Snippet Manager -> Import
That's it. Type tt + Tab and the code block between CDATA[...] is inserted.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>UT Fact</Title>
<Author>AYK</Author>
<Description>Add Unit Test Fact</Description>
<Shortcut>tt</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[
[Fact]
public async Task ObjectBeingTested_Action_ExpectedResult()
{
//arrange
//act
//assert
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Monday, August 24, 2020
Auto generate class diagram in visual studio 2019
From StackOverflow:
In Visual Studio 2019, dragging the whole project to an empty class diagram (add new item -> class diagram) will do the job.
Make sure you have the Visual Studio Class Designer component installed.
Monday, October 29, 2018
Useful debugging tips for Visual Studio
Tuesday, June 26, 2018
MSDN general guidelines for debugging with Visual Studio
You can configure Visual Studio to automatically step over system, framework, and other non-user calls and collapse those calls in the call stack window. The feature that enables or disables this behavior is called Just My Code. This topic describes how to use Just My Code in C#, Visual Basic, C++, and JavaScript projects.
To debug .NET Framework source, you must have access to debugging symbols for the code. You also need to enable stepping into .NET Framework source.
You can enable .NET Framework stepping and symbol downloading in the Options dialog box. When you enable symbol downloading, you can choose to download symbols immediately or just enable the option for later downloading. If you do not download the symbols immediately, symbols will be downloaded the next time that you start debugging your application. You also can do a manual download from the Modules window or the Call Stack window.
- Require Source Files to Exactly Match The Original Version
Sunday, February 4, 2018
Adding files and folders to a click once installation
Here are the steps I followed that finally did it:
- You need to create the folder/file structure just like you want it to exist in your installation - in your visual studio project. For example, I needed two folders - x86 and x64, and the same SQLite.Interop.dll under both
- Right click in your project, go to the Publish tab, then click in Application Files. Scroll down (they should be showing as the last items) to your added files, and make sure you change the Publish Status from Include (Auto) to Include.
Saturday, January 20, 2018
Exe icon is missing in custom Build Configurations after Visual Studio build
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|x86'">
<ApplicationIcon>MyIcon.ico</ApplicationIcon>
</PropertyGroup>
Thursday, May 4, 2017
Building VS projects via command line
Global properties are properties that are set by using the /property switch on the command line, or properties that are set by the integrated development environment (IDE) before a project is built. These global properties are applied to all projects that are built by using this Engine.In other words, if you build a solution with 7 projects (1 start-up plus and 6, say, class libraries), and you provide the AssemblyName parameter like /p:AssemblyName=MyAssembly, you will end up with 7 assemblies with the same name, one with an EXE extension (depending on your project template) and the others with DLL. I, for instance, wanted to rename the final EXE file. Doing this using the approach above did not work for me because of the DLL name conflicts. My scenario uses Jenkins as the CI tool, and I ended up adding a Windows Batch command at the end of the process that renames the $PROJECT_NAME exe only.
Wednesday, February 15, 2017
Why Edit and Continue is not working even though it is marked in Visual Studio ?
AND - your scenario is likely one of the following:
Sunday, December 18, 2016
Reset Visual Studio "Look at these file types" value
{
RegistryKey regKey = null;
try
{
//HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\Find
regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\14.0\Find", true);
var filters = regKey.GetValueNames().Where(v => v.StartsWith("Filter"));
foreach (var filter in filters)
{
regKey.SetValue(filter, string.Empty);
}
}
catch (Exception ex)
{
Console.WriteLine("Registry clear for filter keys failed. {0}", ex.Message);
return;
}
}
Tuesday, November 22, 2016
Find in Visual Studio Find Results (further search)
I then played a bit with it and ended up figuring out that it is possible - it is built in, and it's quite simple: just click CTRL + F inside the Find Results window.
Monday, September 26, 2016
Wednesday, August 17, 2016
Visual Studio Web Development Extensions
Going up one level, you get into http://webtooling.visualstudio.com, that overviews what visual studio offers in covering the technologies being used today.
P.S.: PowerTools has historically given me freezing problems, making it not an option.
P.S. II: The power tools issue mentioned above is gone after moving to Windows 10 (recommend, by the way, seems to give benefits on many other fronts, like Xamarin development, for example).