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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
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#,...
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 ...
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 =>...
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# ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
visual-studio × 250c# × 60
.net × 31
c++ × 20
team-foundation-server × 17
git × 12
asp.net × 11
ide × 11
architecture × 9
version-control × 9
project-structure × 9
projects-and-solutions × 9
project-management × 8
windows × 8
builds × 7
design × 6
vb.net × 6
nuget × 6
msbuild × 6
unit-testing × 5
programming-practices × 5
deployment × 5
winforms × 5
design-patterns × 4
javascript × 4