1

Possible Duplicate:
Copy to Output Directory copies folder structure but only want to copy files

In my project I've created a folder to host com dlls. I add a link reference to them as they sit out of my project and in some directory of the solution. I've updated their CopyToDirectory property to 'Copy always'.

The files are copied successfully on every build, yet they are situated inside a sub folder. For example, for this command in the csproj:

com\libeay32.dll Always

I get a sub directory inside my debug folder called com, with the dll inside it. I don't want the sub directory. I cannot use any post or pre build commands (I am hosting my file on cloud and these commands don't get processed)

Community
  • 1
  • 1
vondip
  • 13,809
  • 27
  • 100
  • 156

1 Answers1

2

I cannot use any post or pre build commands (I am hosting my file on cloud and these commands don't get processed)

Note: Regarding your question, I assume the build process is performed "in the cloud" and that the pre/post build events don't get fired or are blocked (If this is not the case, please correct me I'll try and update my answer accordingly).

How about leveraging the AfterBuild target with a Copy task in your .csproj file?

<Target Name="AfterBuild">
  <ItemGroup>
    <NativeBinaries Include="$(MSBuildProjectDirectory)\com\*.dll" />
  </ItemGroup>
  <Copy SourceFiles="@(NativeBinaries)" DestinationFiles="@(NativeBinaries->'$(OutputPath)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
</Target>
nulltoken
  • 64,429
  • 20
  • 138
  • 130
  • Though I am not sure, what is there differences between Build Process extensions and post \ pre build events ? – vondip Jan 18 '12 at 11:08
  • That might the nice topic for a SO question :) – nulltoken Jan 18 '12 at 16:34
  • BTW, I can't really understand why your pre/post build event won't work. Have you checked [this](http://stackoverflow.com/questions/7123618)? If you're able to "debug" the build process, that may give you some hints. – nulltoken Jan 18 '12 at 16:36