Check Hint Path Task
Motivation
Visual Studio uses hint paths to locate referenced assemblies.
Unfortunately, Visual Studio or Resharper sometimes make a reference to an assembly at a wrong location. For example to bin\debug
instead of packages\MyPackage.1.2.3\net45\
(Nuget).
The Appccelerate.CheckHintPathTask checks whether all hint paths point to a valid location.
Features
- checks hint paths of references in the project file
- valid locations can be configured
- integrated in build process
Installation
You can install the CheckHintPathTask using nuget. The package id is Appccelerate.CheckHintPathTask
.
Configuration
You can overwrite the default behaviour of the CheckHintPathTask by setting properties in the project file.
Excluded Reference Prefixes
All references with a prefix defined by the property ExcludedReferencePrefixes
are excluded.
This is used to exclude all assemblies found in the GAC (global assembly cache). They don't have a hint path.
The default values are System,Microsoft,Windows,Presentation
.
You can overwrite the default values by adding the ExcludedReferencePrefixes
property to your project file:
E.g. <ExcludedReferencePrefixes>System,Microsoft,Windows,Presentation,MyPrefix,MyOtherPrefix</ExcludedReferencePrefixes>
Known Hint Path Prefixes
The property <KnownHintPathPrefixes>
defines all valid prefixes for hint paths.
The default value is ..\packages
(the folder for nuget packages).
You can overwrite the known hint path prefixes by adding the KnownHintPathPrefixes
property to your project file:
E.g. <KnownHintPathPrefixes>..\packages,..\ThirdPartyAssemblies</KnownHintPathPrefixes>
.
TreatWarningsAsErrors
The property TreatWarningsAsErrors
defines whether hint path violations result in warnings or errors.
The default value is false
.
You can overwrite the behaviour by adding the TreatWarningsAsErrors
property to your project file:
E.g. <TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
This will result in errors for invalid hint paths during a releae build.