none
adding needed .dll to my publish RRS feed

  • Question

  • oh I have a  class that need need a .dll file to work.  now I have the programming work in my debug more and in my release mode but when I try to publish the project it cannot file the .dll. and it gives me a runtime error.  

    now Tried this : 

    • Right click project in Solution Viewer
    • Select Add - Existing Item
    • Browse to the DLL and click Add or the little arrow next to the Add button and Add as Link
    • Select your DLL in the Solution Viewer
    • Right click it and select Properties
    • Set Build Action to Content
    • Set Copy to Output Directory to Copy if newer

    but it did not  work.

    I am still getting the same error

    Friday, January 18, 2019 7:43 PM

All replies

  • If you need a DLL in order for your app to work then adding it to the solution isn't the correct approach. If the DLL is another .NET assembly then you should have already added it as a reference to the corresponding project (either binary or via NuGet). In that case the DLL will already be in the output folder so you don't need to do anything.

    If the DLL is a third party DLL that is dynamically loaded at runtime then most teams create a folder under their solution for third party binaries (e.g. dependencies). Then put the DLL in there. You don't need to add it to the solution but be sure it gets included in your source control system. In your project's post build event write the xcopy command to copy the DLL to the output directory of the project. You'll need this for debugging anyway. Something like this.

    xcopy "$(SolutionDir)Dependencies\MyDll.dll" "$(TargetDir)" /R /Y
    This is pulled from memory but it'll copy the DLL (or any file you want) from your "dependencies" folder in the solution root to the output directory of the current project, overwriting any existing file. Since it runs on each build it'll be in the output directory.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, January 18, 2019 9:15 PM
    Moderator
  • Hi Btb4198,

    >>but when I try to publish the project it cannot file the .dll. and it gives me a runtime error.  

    What kind of technology you publishing your application, clickonce or MSI, if you use clickonce, please right click your application -> Properties -> Publish -> Application Files... -> check if the Publish status is Include. 

    If yes, you could find related files with extension named 'deploy' in Application files Folder in publish folder. it will appear in installation folder if you install the application.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 21, 2019 9:46 AM
    Moderator
  • ok I try that but I still got this error :

    Monday, January 21, 2019 10:15 PM
  • Hi Btb4198,

    It is a deploy file, if you want to execute dll file, you need to install the application, it will be appeared in install folder.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 22, 2019 9:07 AM
    Moderator