Hi,
Is there a way in MSBuild task to specify reference folder to find referenced dll if it cannot find in the referenced path specified in the csproj file which it is trying to build.
To state more clearly, the way we can specify References for CSC task is there something similar or a way around.
Thanks
MRI

MsBuild Task and References
AnandAsir
I am not sure if my above post states my question clearly. So just want to rephrase it.
Is there a way to specify MSBUILD task <MSBuild Projects="@(ProjectReferences)".../>
that this is a alternate folder where you should look for referenced assemblies if not able to find in the path specified in the .csproj files which it is trying to build.
Something similar to <assemblyfolders> in NANT.
Thanks
MRI
CoolCasimir
<Project DefaultTargets="BuildOtherProjects" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReferences Include="commerce/Commerce.Cache/Commerce.Cache.csproj" />
</ItemGroup>
<Target Name="BuildOtherProjects">
<MSBuild
Projects="@(ProjectReferences)"
Properties="ReferencePath=C:\look\here"
Targets="Build">
<Output
TaskParameter="TargetOutputs"
ItemName="AssembliesBuiltByChildProjects" />
</MSBuild>
</Target>
dm14011
Thanks for your reply.
1. Problem with first approach is that some of the projects are used in different applications. Hence the Hintpath gets overwritten by the last application checked in.
2. I don't totally understand your second approach. Can you please give a example. I am definitely looking on same line, search the <ReferencePath> if you can't find it as specified in .csproj file.
Part of my build script is as below:
<Project DefaultTargets="BuildOtherProjects" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReferences Include="commerce/Commerce.Cache/Commerce.Cache.csproj" />
</ItemGroup>
<Target Name="BuildOtherProjects">
<MSBuild
Projects="@(ProjectReferences)"
Targets="Build">
<Output
TaskParameter="TargetOutputs"
ItemName="AssembliesBuiltByChildProjects" />
</MSBuild>
</Target>
...
Thanks
MRI
Boba_Phatt
There are two things possible here.
1. For each assembly reference in the projecct, it is possible for you to specify a hint path. <Reference> elements can have a <HintPath> sub element that is the metadata that represents a path where this assembly reference can be hinted at for resolution.
2. You can specify a global references path - simply specify a property called <ReferencePath> that should be used for searching for assembly references. This is also the same property that gets populated when you use Visual Studio / Project Properties and set up reference paths for the project.
Obviously, I am assuming that you are trying to build projects that are either generated by Visual Studio, or import the Common targets. Microsoft.Common.targets does the magic behind what I just described.
Hope this helps.
Faisal Mohamood | Program Manager | Visual Studio - MSBuild
Analytic
MRI -
Where you ever able to resolve your issue I'm converting from Nant to MSBuild, and it's a huge annoyance - almost to the point where I'm considering sticking with Nant. Let me know what you came up with.
John