Excluding Files from ASP.Net deployment
I have a web application that has to reference some common code assemblies, but some of those common code assemblies depend on x86 dlls. Even though I never call into anything that requires x86 these dlls still get copied to my bin folder which prevents me from running my worker process as 64 bit.
Since I create zip files using package / publish feature of asp.net I needed a way to tell it to exclude these files. To make things a little more complex I have to build under TeamBuild so the OutDir property gets set which can screw up your paths.
It took a while but after delving into C:\program files (x86)\msbuild\microsoft\visualstudio\v10.0\Web\Microsoft.Web.Publishing.targets I was able to come up with a solution.
In your project before you import Microsoft.WebApplication.targets define this property
<ExcludeFilesFromPackage>True</ExcludeFilesFromPackage>
Then after importing Microsoft.WebApplication.targets define an ItemGroup
<ItemGroup>
<ExcludeFromPackageFiles Include="$(OutputPath)Bad.x86.dll">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
One other very useful thing I learned while doing this was this property
<EnablePackageProcessLoggingAndAssert>True</EnablePackageProcessLoggingAndAssert>
Setting that property will create another folder in your _PublishedWebsites folder called _Package with a Log folder in it.
There are some useful log files that get created during the package / publish process
AfterExcludeFilesFilesList.txt
AfterTransformWebConfig.txt
ExcludeFromPackageFiles.txt
PackageUsingManifest.parameters.xml
PostAutoParameterizationWebConfigConnectionStrings.txt
PreAutoParameterizationWebConfigConnectionStrings.Log
PreExcludePipelineCollectFilesPhaseFileList.txt
Prepackage.txt
PreTransformWebConfig.Log
