I am trying to do an automated build / deployment of a web application (.NET 4.0) based on Jenkins. A web application project has several links to projects, which in turn have binary links from third-party DLLs.
Problem:
- Second-level links (links to project links) are not pulled into the bin folder in the
obj\<CONFIGURATION>\Package\PackageTmp\bin , which is used to create deployment packages. - When I create a visual studio, second level links are pulled into the regular build output directory.
- When creating dependencies of the second level using MSBuild, they are not pulled into the standard output directory or into the
PackageTmp\bin .
This is confirmed by MS as the Won't Fix problem here .
Related questions here , here and here either do not correspond to my problem, or offer solutions that do not work. I looked through all the answers, not just the accepted ones.
My build team looks like this (using MSBuild 4.0):
MSBuild MySolution.sln / p: Configuration = Integration / p: platform = "Any CPU" / t: Clear, Build / p: DeployOnBuild = true / p: DeployTarget = Package / P: AutoParameterizationWebConfigConnectionStrings = false
I tried to manually edit the Reference elements in the project files, adding <Private>True</Private> , without success.
I am trying to get around this known issue, so my second level dependencies are automatically and correctly pulled into the temp directory of the web publishing.
My current attempt combines the general approach here (setting up the web publishing pipeline by adding the MyProject.wpp.targets file next to the project file website), combined with some MSBuild code to search for the DLL here . So far, this has not yielded any results or broken the project file. I am new to MSBuild custom code and find it rather cryptic.
My question is: I am looking for a more complete example that works in my specific case. I think the goal is to intervene in the web publishing pipeline, which collects files to be copied to the temp directory of the package and adds second-level dependencies to it.
My custom MyWebProj.wpp.targets looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <BRPathFiles Include="$(SolutionDir)..\Common\**\*.dll;$(SolutionDir)**\*.dll" /> <ConfigPathFiles Include="$(SolutionDir)..\Common\**\*.config;$(SolutionDir)**\*.config" /> </ItemGroup> <Target Name="CopySecondLevelDependencies" BeforeTargets="CopyAllFilesToSingleFolderForPackage"> <RemoveDuplicates Inputs="@(BRPathFiles->'%(RootDir)%(Directory)')"> <Output TaskParameter="Filtered" ItemName="BRPaths" /> </RemoveDuplicates> <RemoveDuplicates Inputs="@(ConfigPathFiles->'%(RootDir)%(Directory)')"> <Output TaskParameter="Filtered" ItemName="ConfigPaths" /> </RemoveDuplicates> <CreateItem Include="%(BRPaths.Identity);%(ConfigPaths.Identity);"> <Output ItemName="FileList" TaskParameter="Include"/> </CreateItem> <CreateItem Value="@(BRSearchPath);$(ConfigSearchPath)"> <Output TaskParameter="Value" PropertyName="SecondLevelFiles" /> </CreateItem> </Target> <ItemGroup> <FilesForPackagingFromProject Include="%(SecondLevelFiles->'$(OutDir)%(FileName)%(Extension)')"> <DestinationRelativePath>$(_PackageTempDir)\bin\%(FileName)%(Extension) </DestinationRelativePath> <FromTarget>CopySecondLevelDependencies</FromTarget> <Category>Run</Category> </FilesForPackagingFromProject> </ItemGroup> </Project>