Reputation: 1093
I'm trying to write a custom project (targets?) file that is to be included in several projects.
For example, inside all of my .csproj and .vbproj files I have:
<Import Project="..\MyCustomTargets\custom.targets"/>
Inside that file I have a custom target (AfterBuild) which copies the compiled files to another location.
However, I'd like to add a reference path that each project can look to when trying to resolve references. Is this possible?
For example, I'd like to add something like this to my .targets file:
<AdditionalReferencePath>C:\LookHereForReferences</AdditionalReferencePath>
I've found a few links that describe a little about how to do this but I can't get it working.
Upvotes: 1
Views: 1831
Reputation: 76670
I'd like to add a reference path that each project can look to when trying to resolve references. Is this possible?
You can set a Property Group in your .targets file:
<PropertyGroup>
<AdditionalReferencePath>C:\LookHereForReferences</AdditionalReferencePath>
</PropertyGroup>
After import this targets file in to the project file, you can look it by $(AdditionalReferencePath) when trying to resolve references:
<Import Project="Common.targets" />
<Target Name="Test" AfterTargets="Build">
<Message Text="$(AdditionalReferencePath)"></Message>
</Target>
Upvotes: 1