locked
Preserve folder structure RRS feed

  • Question

  • Hey!

    I'm currently doing a c# project where i move some dll's via the post build event from \Debug\ to \Debug\bin which works pretty nice so far.

    I'm getting the following structure:

    \Debug

               \bin

                     \lib.dll

                program.exe

    Then i'd like to publish my project via clickonce, but i'm getting the following structure:

    \Debug

              \lib.dll

              \program.exe

    Since after publish is being executed before the publish step, is it somehow possible to preserve the structue or move those files again in the publishing process?

    I can't add the lib.dll to the project since it might change from time to time, i need to keep the structure, this means preserving each dll in the bin folder.

    Thanks in advance, searched for hours to find a solution to this. :)

    Thursday, September 29, 2016 10:20 PM

Answers

  • Hi Thoor,

    In my option, I would not suggest you to change the structure of publish folder. It may introduce other issues when you update your application.

    If you insist on changing, I suggest you try to change the manifest and resign your manifest. You could refer the link below for re-sign.

    # How to: Re-sign Application and Deployment Manifests

    https://msdn.microsoft.com/en-us/library/dd465299.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, October 6, 2016 7:25 AM

All replies

  • Hi Thoor,

    >> Then i'd like to publish my project via clickonce, but i'm getting the following structure

    How and where did you check your publish structure? Do you check the Debug folder or Publish Folder? Based on your Folder structure, it seems you do not change the structure in publish folder.

    As my test, if you add post build event to copy file, the file will also be copied to Debug Folder for the post build event will run before publishing.

    It would be helpful if you could share us more information about your detailed steps.

    For copying file in build process, I suggest you refer the link below for another way.

    #How to: Extend the Visual Studio Build Process

    https://msdn.microsoft.com/en-us/library/ms366724.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Friday, September 30, 2016 7:39 AM
  • Hi Edward,

    I publish my app via "Project->Properties->Publish", my project file contains the following:

    <PostBuildEvent>if not exist bin mkdir bin
    move /Y "$(TargetDir)*.dll" "$(TargetDir)bin\"
    move /Y "$(TargetDir)*.xml" "$(TargetDir)bin\"</PostBuildEvent>
      </PropertyGroup>
      <Target Name="AfterPublish">
        <Message Importance="Normal" Text="HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH" />
      </Target>
      <Target Name="BeforePublish">
        <Message Importance="Normal" Text="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
      </Target>

    The last to targets are applied as test, but i can't read the text anywhere in the console.

    I checked my build folder (strucure as wished), and the publish folder (structure not as wished).

    Did I miss any important step?

    Saturday, October 1, 2016 1:26 PM
  • Update: got the messages with Importance="High" but can't find any reference to move files like in the PostBuildEvent.

    I assumed it would use the build structure.

    Do you know the command?

    Saturday, October 1, 2016 3:49 PM
  • Ok got it working, but the manifest file contains the old structure.

    Which target do I need to specify in the BeforeTargets attribute to get before the deployment manifest generation?

    Sunday, October 2, 2016 3:55 PM
  • Hi Thoor,

    Do you want to change Debug Folder, Publish Folder or Install Folder? I am not sure your requirements.

    >>Which target do I need to specify in the BeforeTargets attribute to get before the deployment manifest generation?

    Have you achieved moving files? I suggest you try BeforeBuild, AfterBuild or BeforePublish. Something like below:

      <Target Name="BeforeBuild">
        <Copy SourceFiles="ClassLibrary.dll" DestinationFolder="target path" />
      </Target>

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 3, 2016 3:15 AM
  • Hi Edward,

    I wanna change the Publish Folder, i achieved moving those files but it seems it's too late because the manifest file contains the wrong path to the dll's.

    My current code is:

    <Target Name="BeforePublish">
        <Message Importance="High" Text="BeforePublish: $(MSBuildProjectDirectory)\$(OutputPath)app.publish\Application Files\TimeTool_0_6_0_36\bin" />
        <MakeDir Directories="$(MSBuildProjectDirectory)\$(OutputPath)app.publish\Application Files\TimeTool_0_6_0_36\bin" />
      </Target>
      <ItemGroup>
        <DeployDlls Include="$(MSBuildProjectDirectory)\$(OutputPath)app.publish\Application Files\TimeTool_0_6_0_36\*.dll.deploy" />
      </ItemGroup>
      <Target Name="AfterPublish" DependsOnTargets="GenerateDeploymentManifest">
        <Message Importance="High" Text="AfterPublish: $(MSBuildProjectDirectory)\$(OutputPath)app.publish\Application Files\TimeTool_0_6_0_36\bin" />
        <Move SourceFiles="@(DeployDlls)" DestinationFolder="$(MSBuildProjectDirectory)\$(OutputPath)app.publish\Application Files\TimeTool_0_6_0_36\bin" />
      </Target>	

    The Problem is the manifest file contains the wrong path, eg.: codebase="xyz.dll" instead of codebase="bin\xyz.dll"


    • Edited by Thoor_ Monday, October 3, 2016 4:44 PM
    Monday, October 3, 2016 3:57 PM
  • Hi Thoor,

    In my option, I would not suggest you to change the structure of publish folder. It may introduce other issues when you update your application.

    If you insist on changing, I suggest you try to change the manifest and resign your manifest. You could refer the link below for re-sign.

    # How to: Re-sign Application and Deployment Manifests

    https://msdn.microsoft.com/en-us/library/dd465299.aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, October 6, 2016 7:25 AM