Reputation: 489
My web application basically have three seperated projects:
To do Dependency Injection, my MyWeb project just add reference to the MyBusiness
interfaces project, not the implementation (or else my web project is closely tied to the implementation, and also I can't prevent my developers from making a "new" object of a concrete class in my web project).
Without adding reference directly to the Business implementation project, when building the project, Visual Studio doesn't know to copy the implementation project's DLL into the web's bin folder, so I added this into MyWeb project file:
<PropertyGroup>
<BuildDependsOn>BuildDependentProjects;$(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<ProjectToBuild Include="$(SolutionDir)\MyBusinessImplementation\MyBusinessImplementation.csproj">
<Properties>Configuration=$(Configuration)</Properties>
</ProjectToBuild>
</ItemGroup>
<Target Name="AfterBuild">
<Copy SourceFiles="$(SolutionDir)\MyBusinessImplementation\bin\$(Configuration)\MyBusinessImplementation.dll" DestinationFolder="$(SolutionDir)\MyWebSite\bin"></Copy>
</Target>
<Target Name="BuildDependentProjects">
<MSBuild Projects="@(ProjectToBuild)" />
</Target>
The problem is, when I publish MyWeb project from Visual Studio 2012, or when I run
"MSBuild "MyWeb.jsproj" \T:Package \P:Configuration=Debug"
I see that the MyBusinessImplementation.dll is copied into MyWeb's bin folder of my working code directory but NOT in the published package directory.
I've also tried to change the DestinationFolder of the Copy task to an absolute path like "C:\abc" then I see the .dll file is copied successfully to the abc folder, but still not copied to my Package's web's bin folder.
Upvotes: 3
Views: 3136
Reputation: 4680
It looks like you are missing a step of adding the copied item to the WebDeploy manifest and package before its deployed.
Check this post out for a great answer on how to include extra files to the package.
How do you include additional files using VS2010 web deployment packages?
Upvotes: 1