58 votes
Accepted

Why would a development team insist that using a single solution for multiple projects in Visual Studio "increases interdependence complexity"?

You don't need to tell them how to structure their projects. Instead, make it a hard requirement that you can build the system from source by running one single script, without getting any errors. If ...
Doc Brown's user avatar
  • 203k
37 votes
Accepted

Strategies for merging 1 year of development in Visual Studio

There would have been a simple way which had kept your new development separate from the main branch without bringing you into this unfortunate situation: any change from the trunk should have been ...
Doc Brown's user avatar
  • 203k
31 votes
Accepted

Directory structure for a .NET Solution

On MSDN, there are some very old official guidelines. These are out of date though. As the page says, "This content is outdated and is no longer being maintained. It is provided as a courtesy for ...
David Arno's user avatar
  • 39.1k
28 votes
Accepted

Is Microsoft discouraging the use of 'var' in C#? (VS2017)

TL;DR: no, Microsoft are not discouraging the use of 'var' in C#. The image is simply lacking context to explain why it's complaining. If you install VS2017 RC and open up the Options panel and go to ...
David Arno's user avatar
  • 39.1k
26 votes

Forbid calls to arbitrary functions/classes in external code

You can do time-consuming things like writing a wrapper around the external API that leaves out your undesired operations, but nothing beats training and code reviews, because whatever standards or ...
Karl Bielefeldt's user avatar
19 votes

How to see bits of an integer in Visual Studio

There's no obvious option for it in the UI, but if you put ,b after your watch variable name, it will show the binary representation.
Twicetimes's user avatar
19 votes
Accepted

Why use a local variable over a global variable?

This is a great question! Much programming advice and "best practices" comes down to the question of managing complexity. Or to put it plainly: How do we write and manage a large complex program ...
JacquesB's user avatar
  • 57.8k
15 votes
Accepted

If you follow the rule of Zero, how will you debug the construction of an object?

After much debate, many lunches, posts on various forums, and head scratching, a colleague of mine came up with the following: In Visual Studio, go to Debug->New Breakpoint->Function Breakpoint and ...
Christopher Pisz's user avatar
14 votes
Accepted

Where to put the Angular app in a ASP.NET Web API solution?

You have two options. Create separate mywebsite.api and a mywebsite.app projects in your solution. Advantages Proper separation of concerns. You can deploy updates to your api and your front end ...
CountZero's user avatar
  • 256
14 votes
Accepted

Have the unit test "using" the project, or just have same namespace?

Your unit tests are in a separate project and serve a separate function from your main code, so putting them into a separate namespace makes the most sense to me. If you're considering putting them ...
svick's user avatar
  • 10k
14 votes

Strategies for merging 1 year of development in Visual Studio

At that stage of merge I would say that automated merging may only over complicate the process. I have had similar issues with branches that have diverged for over a year and the most effective method ...
Erdrik Ironrose's user avatar
12 votes
Accepted

Forbid calls to arbitrary functions/classes in external code

Are there any reliable and reasonably straightforward ways to achieve these constraints on external code, except from certain specific places in our own code? As the question is specifically about C#,...
David Arno's user avatar
  • 39.1k
12 votes

Extension methods vs. Static Class Methods

I think extension methods are more "discoverable". If I have a certain type, Intelli-sense will automatically give me the extension methods. When a static class and method, I have to know the name ...
Jon Raynor's user avatar
11 votes

Extension methods vs. Static Class Methods

The biggest advantage for me is readability. Consider for a moment a typical LINQ statement that uses method chaining: var total = myList.Where(x => x.num > 5) .Select(x =>...
Becuzz's user avatar
  • 4,845
9 votes

Extension methods vs. Static Class Methods

There is no industry standard here about whether to use extension methods or static classes. Honestly, "extension methods" are in static classes. This is a case where the language designers of C# ...
Greg Burghardt's user avatar
8 votes
Accepted

Trust .net compiler after Microsoft updates

Completely testing an application will be time prohibitive? Write some unit tests. Write some integrations tests. Automation is your friend. It should take under a minute to provide 90% or so ...
Telastyn's user avatar
  • 109k
8 votes

Strategies for merging 1 year of development in Visual Studio

A few years back we had a client with the same requirements of keeping branches separate. So we did. We never merged their branch back. They had there own unique version. We charged them extra ...
Jon Raynor's user avatar
7 votes
Accepted

How to "state of the art" integrate multiple sub-modules with duplicate dependencies?

Your incompatible Logger implementations cannot be linked because they have the same name. This leads to a simple solution that will solve all your problems: Incompatible versions should have ...
amon's user avatar
  • 134k
6 votes

How to get a good overview of an Agile backlog?

The bits of this question that aren't around tooling are well answered in this question that @MichaelT already pointed to. Agile is opposed to over-planning As far as tooling to support long-range ...
Gort the Robot's user avatar
6 votes

Do MSBuild project files serve the same purpose as NMAKE makefiles in a build process? (practically equivalent)

Both fulfill the same purpose of controlling and automating complex build processes. However, MSBuild is more modern, has more capabilites, and it integrates much (!) better into the build process of ...
Doc Brown's user avatar
  • 203k
6 votes

Is Microsoft discouraging the use of 'var' in C#? (VS2017)

I think you are reading too much into it. So, there is a feature that allows you to replace usages of implicit typing with explicit type annotations, and you conclude from that, that implicit typing ...
Jörg W Mittag's user avatar
6 votes
Accepted

Organizing Visual Studio solution for microservices?

We ultimately found that decisions made about the devops pipeline and the microservices platform will likely dictate how the Visual Studio projects and solutions are organized. Initially, we decided ...
Daniel's user avatar
  • 249
6 votes
Accepted

IOC Classes are polluting my project

IoC is a very good thing. But factories that have a strictly 1 to 1 relationship with what they make aren't doing you much good. A factory should make something FOR something. They shouldn't be a ...
candied_orange's user avatar
6 votes

Extension methods vs. Static Class Methods

The big gain for extension methods is that they allow you to add extra functionality to .Net Framework or 3rd party classes that you don't have the source code for or can't otherwise modify. For ...
Peregrine's user avatar
  • 1,236
6 votes

Best practice for knowing the link between binaries (*.exe and *.dll) and their source code?

The general idea is always the same: whenever you create a release of your product, make sure you assign a new unique version number to the end product, and use that version number for tagging the ...
Doc Brown's user avatar
  • 203k
5 votes
Accepted

Project structure: Where to put object factories

TLDR It depends on how configurable and extendable you want to have the reusable library (project), without touching it. In the end you either have factories in the library itself, or the library ...
Andy's user avatar
  • 10.3k
5 votes
Accepted

Proper way to deploy ASP.net to production web server

From my painful experience, the more of deployment process is being done manually, the bigger trouble you'll get into. And both your current steps require heavy manual effort. Here are my ...
Harry Ninh's user avatar
5 votes

Abuse of XML comments to keep comments up-to-date (in C#)

Outside the world of Visual Studio, where developers expect everything to happen automagically, greping source code is a usual practice, and it actually works very well. The problem with Visual ...
Arseni Mourzenko's user avatar
5 votes

When should I care about code metrics in Visual Studio?

Code metrics are simply sensors that indicate when something is out of an expected range. Taken in isolation, they really aren't that interesting as you point out, you can already guess at what it's ...
Berin Loritsch's user avatar
5 votes

Is it possible to throw compiler error when attempting to use an unimplemented method?

Someone had posted earlier about the Obsolete attribute, which can be configured to throw an compile error when attempting to use a method that is decorated as such. I don't know why that answer got ...
christok's user avatar
  • 177

Only top scored, non community-wiki answers of a minimum length are eligible