Reputation: 4819
I have found many many answers in stack overflow and tips around the web recommending to use that, and i realize that it suppose to copy referenced dll's to the output folder. I want to understand that target's logic and how to use it properly, and so far I couldn't find anything around the web explaining it. There was one line on it in MSDN
In my project I get the dll's in the root output folder, not in the "Bin" folder, which is three levels down so I don't really see the point of it. I'd rather get a full explenation than a solution to my one time problem.
Thanks in advance
<Target Name="BuildSolutionWithConfig">
<Message Text="Build: $(BuildType) $(SolutionFileName)"></Message>
<MSBuild Projects="$(SolutionFileName)" Targets="_CopyWebApplication; ResolveReferences" Properties="Configuration=$(BuildType);OutputPath=$(BuildOutputPath);"></MSBuild>
<JsAndCssUpdater Path="$(FullPath)" Version="$(JsVersion)" PathToSaveLogAndBackup="$(PathToSaveLogAndBackup)"/>
<MSBuild.ExtensionPack.Compression.Zip ZipFileName="$(BuildOutputPath)\..\$(BuildType).zip" CompressPath="$(BuildOutputPath)" TaskAction="Create"/>
</Target>
Upvotes: 1
Views: 6218
Reputation: 14457
By default, at least in MSBuild 12.0, the ResolveReferences
target literally does nothing itself. It just depends on a number of other targets. From %PROGRAMFILES%\MSBuild\12.0\Bin\Microsoft.Common.CurrentVersion.targets
:
<!--
============================================================
ResolveReferences
============================================================
-->
<PropertyGroup>
<ResolveReferencesDependsOn>
BeforeResolveReferences;
AssignProjectConfiguration;
ResolveProjectReferences;
FindInvalidProjectReferences;
ResolveNativeReferences;
ResolveAssemblyReferences;
GenerateBindingRedirects;
ResolveComReferences;
AfterResolveReferences
</ResolveReferencesDependsOn>
</PropertyGroup>
<Target
Name="ResolveReferences"
DependsOnTargets="$(ResolveReferencesDependsOn)"/>
To my knowledge, none of the default targets in $(ResolveReferencesDependsOn)
actually copy the files to your output directory either. Rather, these targets identify where the files are and, in some cases, cause other projects to be built so that the files are available. Because <MSBuild>
tasks can specify the locations of their outputs, it should not matter where the target actually puts the files as long as the (for example) ResolveProjectReferences
target can access them from the paths that <MSBuild>
returns.
Upvotes: 2