Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can I do to get the _PublishedWebsites folder include missing DLLs

My IIS project references a setup project that references an NServiceBus project that has a nuget package for a dll:

IISProject->SetupProject->NServiceBusProject->NugetPackage.

When I run my auto build (TFS) the NugetPackage.dll and NServiceBusProject are copied to the output folder. But they are not copied to the _PublishedWebsites folder. (But all other dlls that I need are copied.)

I am at a loss for how to get those files to copy over automatically.

The common answer on the internet is to set CopyLocal = True. But it is already true for the NugetPackage and NServiceBusProject references.

Does anyone know how to say "I really do want you to include dependent projects in the published sites?

Or is there anything else I can look at?

like image 324
Vaccano Avatar asked Oct 23 '22 13:10

Vaccano


1 Answers

Since I just dealt with something like this, despite the age of this question, here is what I ended up doing. It isn't ideal, but it does work.

Set a post-build event on the project you actually are building. In the build event, you can reference your current location using the $(ProjectDir) variable. Set up a path that points to the "normal" location of the dll you need after its project has been built. I think in your case this would be the bin directory of the NServiceBus project.

You can get to the "_PublishedWebsites" directory using the $(WebProjectOutputDir) variable. When building locally, this points to the same directory as the project being built. However, when msbuild is called with a nonstandard output directory (aka from TFS), it changes to the publish directory.

xcopy /Y /S "$(ProjectDir)..\path to needed dll" "$(WebProjectOutputDir)\bin"

Your builds should work both locally and in your build environment with this script. The only downside is that it is a bit brittle because you need to specify the exact name and relative location of the missing dlls.

like image 80
SouthShoreAK Avatar answered Oct 31 '22 20:10

SouthShoreAK