Daniel Cazzulino's Blog

Go Back to
kzu′s Latest post

OutDir vs OutputPath

Which one should you use? Seems like OutputPath is the way to go, since it’s the one that is specified on every project you create, right inside the Debug or Release configuration.

From C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets, however, we learn:

Indicates the final output location for the project or solution. When building a solution,
OutDir can be used to gather multiple project outputs in one location. In addition,
OutDir is included in AssemblySearchPaths used for resolving references.

This property is usually specified in the project file and is used to initialize OutDir.
OutDir and OutputPath are distinguished for legacy reasons, and OutDir should be used if at all possible.

Sometimes the best way to understand MSBuild is to dig deeper in the built-in targets. They are pretty well self-documented.


1 Comment

  1. Dear Mr. Calzzulino,

    I am new to Moq. I have question about how to apply Moq in Multi-layer application. For example, I have application which include a Dclass to access database, a business Bclass1 to do something with the data from data access class, another business Bclass2 to do something with class1′s operation and etc. If I want to test a method in Bclass2 and want to use Moq to mock the database, should I expose the DClass’s interface to Bclass2?
    Or should we make Bclass1 to implement an interface, then make Mock Bclass’s interface to test Bclass2?
    Could you please provide with best practice of Moq in multi-layer application?

    Thank you!

    Have a nice day!