3

Context

In VS2012 I have 1 sln file with several projects under it. Some are just code libraries and others are web applications. And then we also have 1 web site project...

This web site project was recently updated to .NET 4.0 which also meant that we needed to update the wdproj that our build server uses. I tried this but alas, the build kept on failing.
I decided to get rid of the wdproj and use the newer Publish profiles. Which was very easy to generate in VS2012.
On the build server I used the following command:

<MSBuild Projects="<path to publishproj file>" Properties="DeployOnBuild=true; 
    PublishProfile=name-of-profile; VisualStudioVersion=11.0" />

In the PublishProfile, the WebPublishMethod is FileSystem so it just needs to copy everything to a folder.

Problem

The web site project contains 6 ProjectReferences which get build by msbuild. The resulting folder contains the dll of those projects but is missing all referenced dlls of those projects nor does it copy the satellite assemblies (compiled resource files in subfolders).
So I'm missing several dlls!

Does anyone know a solution for this?

Info already found

I can find several posts which describe the same behaviour but they either don't have a solution or have a suboptimal fix.
Example: MSBuild doesn't copy dll references from dependent projects
Similar question: MSBuild Package via Command line not including all my Assemblies

I also started looking into the msbuild process to the specific copy code used in Microsoft.WebSite.Publishing.targets. In the target 'AfterResolveReferences' the dlls of the referenced project are copied but not the depending dlls.

All help is much appreciated!

Community
  • 1
  • 1
MagnusJarl
  • 33
  • 1
  • 5

2 Answers2

0

Got it working!

You have to include all referenced dlls from your projectreferences in your Web site project.

Thanks to Sayed Hashimi for the help!

Community
  • 1
  • 1
MagnusJarl
  • 33
  • 1
  • 5
-1

Including all referenced dlls from your projectreferences in the Website project is not always a good idea, especially when you're using Dependency Injection: your web project just want to add reference to the interface dll/project, not any concrete implementation dll. Because if you add reference directly to an implementation dll/project, you can't prevent your developer from calling a "new" on concrete classes of the implementation dll/project instead of via the interface, it's also you've stated a "hardcode" in your website to use the implementation.

Hung Nguyen
  • 489
  • 7
  • 20