Hi,
i had a look on many similar questions on this side but none of them answered the question to my problem. The whole day i tried to solve this by finding a solution (via google etc.):
I have 4 projects in my VS solution (everyone targeting .net 3.5) - for my problem only these two are important:
- MyBaseProject <- this class library references a 3rd party dll (elmah.dll)
- MyWebProject1 <- this web application project has a reference to MyBaseProject
I added the elmah.dll reference to MyBaseProject in Visual studio 2008 by clicking "Add reference..." -> "Browse" tab -> selecting the "elmah.dll".
The Properties of the Elmah Reference are as follows:
- Aliases - global
- Copy local - true
- Culture -
- Description - Error Logging Modules and Handlers (ELMAH) for ASP.NET
- File Type - Assembly
- Path - D:\webs\otherfolder\_myPath\__tools\elmah\Elmah.dll
- Resolved - True
- Runtime version - v2.0.50727
- Specified version - false
- Strong Name - false
- Version - 1.0.11211.0
In MyWebProject1 i added the reference to Project MyBaseProject by: "Add reference..." -> "Projects" tab -> selecting the "MyBaseProject". The Properties of this reference are the same except the following members:
- Description -
- Path - D:\webs\CMS\MyBaseProject\bin\Debug\MyBaseProject.dll
- Version - 1.0.0.0
If i run the build in visual studio the elmah.dll is copied to my MyWebProject1's bin directory, along with MyBaseProject.dll!
However if i clean and run msbuild for the solution (via D:\webs\CMS>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /t:ReBuild /p:Configuration=Debug MyProject.sln) the elmah.dll is missing in MyWebProject1's bin directory - although the build itself contains no warning or errors!
I already made sure that the .csproj of MyBaseProject contains the private element with the value "true" (that should be an alias for "copy local" in VS):
<Reference Include="Elmah, Version=1.0.11211.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\mypath\__tools\elmah\Elmah.dll</HintPath>
**<Private>true</Private>**
</Reference>
(The private tag didn't appear in the .csproj's xml by default, although VS said "copy local" true. I switched "copy local" to false - saved - and set it back to true again - save!)
What is wrong with MSBUILD? How to get the (elmah.dll) reference copied to MyWebProject1's bin?
I do NOT want to add a postbuild copy action to every projects postbuild command! (Imagine i would have many projects depend on MyBaseProject!)
Please help. I get mad on this!
Thanks, tobi