Posts about Visual Studio
By default, JetBrains Rider displays additional type information and parameter names in text editor windows. They are called inlay hints. Visual Studio's default configuration doesn't display any such type or parameter information. You only see what is already present in the code.
While preparing the sample project for my blog post about JWT authentication, I spent too much time troubleshooting an issue with failed authentication of calls from .http files in Visual Studio. It turned out to be caused by how Visual Studio handles redirects. I decided to check how Bruno and Postman behave in this scenario.
In the sample project for my previous blog post, I noticed that every time I ran my test, its code was executed twice. At first, I thought that I had a bug in my code, but quickly dismissed this option. After further investigation, I finally attributed the strange behavior to the Fine Code Coverage Visual Studio extension.
After I updated my copy of Visual Studio 2022 to the latest version 17.6, I couldn't run the tests from the Test Explorer anymore that worked just fine in version 17.5. I had similar experience in the past, so I immediately suspected that the problems were related to the versions of test-related NuGet packages in my project.
I recently attended an online presentation on how to effectively use Visual Studio Code. The presenter did a great job of explaining the keyboard shortcuts he used. It would have been even easier for him if he had turned on screencast mode to show the keyboard shortcuts and the actions triggered in the editor. He was very excited when I told him about it after the presentation. I decided to do some research on similar features in other editors I use regularly.
When referencing NuGet packages of third-party libraries, you usually want to use the latest stable version available. But you probably should not do that with Microsoft.CodeAnalysis.CSharp if you are developing your own source generator. Otherwise, you unnecessarily limit the versions of Visual Studio in which your source generator will work.
When you create a publish profile in Visual Studio, the password for accessing the target Azure service is also stored. However, if this password changes in Azure or if you retrieve the publish profile from source control so that there is no valid password stored in your copy of Visual Studio, you must enter the password during publishing. Where can you find the valid password and how can you store it again in Visual Studio?
When I started working with .NET MAUI, I immediately noticed that the code files generated by the project template use tabs instead of spaces for indentation (unlike all other .NET project templates). This bothered me, but fortunately it can be easily fixed.
Using SSH with Git on Windows mostly works out of the box. The .gitignore file allows a lot of additional configuration. The sshCommand in the core section allows you to specify the path and arguments for the ssh.exe command. However, specifying a path there is mostly asking for trouble.
The project properties window has been redesigned in Visual Studio 2022. But not only the appearance has changed. For at least some options, the effect of the changes in the project properties window has also changed. Let us take a look at how the behavior of the Allow unsafe code build option has changed.
At the end of November the second part of my Visual Studio video course was published. With that, all of the materials which I was recording during summer and early autumn are finally available for everyone to watch.
I've been pretty busy since early summer, spending most of my spare time recording a video course about features for debugging and testing in Visual Studio 2017. Since Monday, the first part of this video course is finally available to everyone.
On Saturday the fifth annual Global Azure Bootcamp event was taking place all around the globe. In Slovenia the event was organized in Ljubljana at the premises of the local Microsoft subsidiary. I showcased the Visual Studio integrations for Azure Storage, Application Insights and publishing of ASP.NET Core web applications to App Service on Windows and Linux.
Tuesday was the Visual Studio 2017 release day. To celebrate this occasion, Microsoft organized an official 2-day launch event. It was accompanied by a large number of local events all across the world. One of them was organized in Ljubljana as well. I had a short session there, presenting the most important new features and improvements in Visual Studio 2017.
Many operators and other symbols in programming languages consist of multiple characters, but still represent a single token. Although as programmers we learned to view these symbols as single logical units, ligatures allow joining of multiple neighboring letters into a single glyph. With correct fonts and editor support these can be used to improve the rendering of source code on screen.
I selected Bower as the package manager for client-side JavaScript libraries in my Cordova project. I already took care of copying the required JavaScript files to a folder that will be packaged into the application. However, to use the scripts, they also need to be referenced from the HTML page(s). I don't want to do it manually if I can automate the process.
Visual Studio Tools for Apache Cordova is a Visual Studio extension for developing Cordova apps inside Visual Studio. Although it comes with a TypeScript based project template, it is not fully preconfigured for package managers that can simplify the use of JavaScript libraries and TypeScript definitions. This post describes how I configured a project I recently started working on.
If you're used to the old ASP.NET, it's not all that obvious how to deploy an ASP.NET Core application to IIS. Although, there is documentation available for the process, I still struggled a bit, before I got everything working. This post contains the steps I had to take, so that I can simply follow them the next time. At least, until something changes again with one of the future releases.
Ever since I have tried out NCrunch, I never looked back. Continuous running of tests as implemented in NCrunch significantly changed how I look at tests. Since then continuous testing has become much more mainstream and today both ReSharper and stock Visual Studio offer support for it. It was about time I took another look at the other tools and see how they compare to NCrunch today.
You might not be aware of it, but Visual Studio projects have additional identity beyond their project file name and path. Each one of them contains a GUID value which should by definition be unique in normal circumstances. The troubles begin, when you create a copy of a project by copying its folder and renaming the files.
The new version of NDepend brought many new features; among them also integration with TeamCity build server. This convinced me to give it another closer look; evaluating how taking advantage of this can contribute to increasing code quality in larger development teams.
This week the first Cancel conference was taking place in Nova Gorica. I had the last two sessions in one of the development tracks: Diagnostic analyzers in Visual Studio 2015 and Debugging in Visual Studio 2015. Slides and demos are available for download.
Visual Studio Tools for Unity enable the convenience of developing Unity scripts inside Visual Studio. A naive attempt to install a random NuGet package into the UnityVS project will still most likely fail. To make it work, the NuGet package will need to comply with special requirements. Even then, there will still be some manual work left.
Productivity Power Tools for Visual Studio 2013 introduced a great feature called Presenter Mode, temporarily increasing the fonts both in the text editor and Visual Studio itself, without having to change the settings and thus affecting your working environment. Since the extension is not (yet) available for Visual Studio 2015, we need to make do with one of the alternatives.
SlowCheetah is a very useful Visual Studio extension which builds upon Visual Studio's built-in support for Web.config transformations. It adds similar XDT transformation file support to non-web projects which can be used even during debugging, while built-in solution for web projects only works for web deployment. There is already a feature request for SlowCheetah for it, but until it's implemented, you'll need to find a different solution.
According to the C# language specification, the static field initializer should execute before it is accessed for the first time. As it seems, looking up the field value in debugger doesn't trigger the initializer.
After I set up multiple different configurations for my ASP.NET project with different .config file transformations for different environments, a build error started showing up every time I changed to a different configuration. The issue could be resolved by manually deleting a file from obj folder, but I soon got tired of this and decided to investigate further.
When using NuGet, you typically don't need to worry about its repository location. In simple every day scenarios it just works without even paying attention to it. Once you have more than a single solution file for your product, this default approach starts to break down. To be more precise; the problems occur when a single project file is included in multiple solutions files, which are not placed in the same folder.
Since I usually write my unit tests in NUnit, I got into the habit of using parameterized tests when testing methods for which I need to check the result for many different input values. Unfortunately using NUnit is not an option with Windows Store apps. Only MSTest is supported, providing data-driven unit tests for such cases.
I often find myself speaking at technical conferences and user group meetings and due to the nature of my sessions, there are usually demos involved. A particular kind of demos I often struggled with to make them work well within a session, are the ones in multiple steps, i.e. they show the same project or solution in different stages of development.
The book addresses a lot of advanced topics throughout the chapters, as expected based on the target audience of experienced .NET developers. Still, most of the chapters include some basic topics as well, which slow down the pace.
When moving a Windows Phone project referencing Microsoft.Bcl.Async package to a new computer I was unpleasantly surprised. Although I had NuGet package restore enabled on the solution, it not only failed to build, it even failed to load. After some investigation I found out that this was a known limitation in NuGet.
If you've only been using NuGet in typical scenarios with a single solution containing a couple of projects, it probably worked great for you. As soon as the project structure is a bit more complex, things start falling apart. There are two main reasons why it doesn't work as expected when individual projects are included in multiple solution files residing in different folders.
It seems that Visual Studio 11 Beta works better and more reliable in Windows 7 than it does in Windows 8 Consumer Preview. In Windows 7 I've been running it without problems, using Slovenian regional settings. In Windows 8 Consumer Preview on the other hand it doesn't even start properly when regional settings are set to Slovenian.
NuGet is a valuable tool for managing references to external libraries in your projects. If you're not using it yet, you owe it to yourself to try it out and see what you're missing. Though, that's not what this post is about. Not only are NuGet packages a great way to distribute publicly available libraries, they can be used just as well for custom internal libraries with their own release management which are used in multiple projects.
Web.config transformations are a great but often overlooked feature introduced with ASP.NET 4.0. They provide a simple way to define a different configuration for Debug and Release builds of your project by only specifying the differences (typically only connection strings and similar settings) in a separate transformation file while keeping the core of the configuration file common and consequentially making it easier to manage.
My favorite environment for running NUnitunit tests during the development process is definitely Unit Test Runner in CodeRush. When I just recently had to get a usable development environment up and running with Visual C# 2010 Express, I had to find a different solution since extensions are not supported in the Express SKUs of Visual Studio.
Once the number of projects in a solution comes up to thirty or more, most of the project related operations become really slow. It is something to have in mind when deciding how to group projects in solutions.
Trying to build a C++ project opened from a network share in Visual Studio 2005 might fail with a strange error. The problem only appears when the share host can't authenticate the user reading from and writing to the share.