Note: These topics discuss customizations which apply to self-hosted Blackbaud NetCommunity websites. If Blackbaud hosts your Blackbaud NetCommunity website, please contact Blackbaud for more information about your options for customizations.

Build and Deploy a Custom Framework Part (Type)

In this section:

Adjust the Post-build Events

Copy the Files for a Custom Part

Test the Build and Post-build Commands

Adjust the Post-build Events

Note: These steps require Visual Studio.

  1. Ensure the Parts project is open.

    Note: Some tasks may require Administrator rights to folders on your developer machine. If you do not have Administrator rights enabled by default, you may have to run Visual Studio as an Administrator.

    From Solution Explorer, right-click the project and select Properties.

    The Properties appear.

  2. Click Compile.

  3. Click Build Events.

    The Build Events screen appears.

  4. Click Edit Post-build.

    The Post-build Event Command Line screen appears. There are template XCOPY commands in the editor. These commands copy files from the built project to the Blackbaud NetCommunity installation.

  5. Clear the template commands in Post-build event command line and replace the commands with these:

    xcopy "$(ProjectDir)*.ascx" "C:\Program Files\Blackbaud\NetCommunity\Custom\$(ProjectName)" /s /I /y
    xcopy "$(TargetDir)$(ProjectName).*" "C:\Program Files\Blackbaud\NetCommunity\Bin\" /y
    

    Adjust the paths for your Blackbaud NetCommunity installation:

    xcopy "$(ProjectDir)*.ascx" "C:\Program Files\Blackbaud\NetCommunity\Custom\$(ProjectName)" /s /I /y
    xcopy "$(TargetDir)$(ProjectName).*" "C:\Program Files\Blackbaud\NetCommunity\Bin\" /y
    

    The first line copies the Active Server Pages forms and the second line copies the DLL for the Part.

    Once you begin to reference other items in the project, such as API DLLs, you may have to add or adjust lines. For example, this will copy WebAPIClient DLLs:

    xcopy "$(TargetDir)*.WebApiClient.*" "C:\Program Files\Blackbaud\NetCommunity\Bin\" /y
  6. Click OK. You return to the Build Events screen.

  7. Click OK. You return to the project's properties.

  8. Save the project.

Copy the Files for a Custom Part

Typically, a custom part consists of two user controls (.ascx files) and one or more DLL assemblies for your project. You copy the .ascx files to the \NetCommunity\Custom folder of your installation (or a subfolder within \NetCommunity\Custom), and you copy the .dll files to the \NetCommunity\bin folder.

You must deploy custom parts every time you build a Parts project, so to save time and reduce errors, you can configure the project’s post-build event to automatically deploy the project after you build.

  1. In Visual Studio, open the properties sheet for the Parts project.

  2. On the Compile tab, click Build Events. The Build Events screen appears.

  3. Click Edit Post-build. The Post-build Event Command Line appears.

  4. In the command line edit window, replace the default post-build event commands with the following commands and then replace the destination paths with the locations in your installation directory:

    copy "$(ProjectDir)*.ascx" "C:\Infinity\DEV\Firebird\ClassicCMS\Web\Content\Portal\Custom\$(ProjectName)" /s /I /y
    xcopy "$(TargetDir)$(ProjectName).*" "C:\Infinity\DEV\Firebird\ClassicCMS\Web\Content\Portal\bin" /y
    xcopy "$(TargetDir)*.WebApiClient.*" "C:\Infinity\DEV\Firebird\ClassicCMS\Web\Content\Portal\bin" /y
  5. Replace the destination paths in the commands with the appropriate locations in your installation directory. Remember to place your .ascx files in the \custom folder or a subfolder and your code-behind DLL and any *.webApiClient.dlls in the \bin folder.

  6. When you successfully recompile, these commands copy files to your installation folder.

Note: For more complex custom parts, you can add commands to copy related files such as images, scripts, and style sheets.

Test the Build and Post-build Commands

  1. Open the Parts project.

    Note: Ensure Visual Studio is open with Administrator rights. The BBIS installation folders are probably protected.

  2. Right-click the project and select Build. A successful build should look like this in the Output window:

    ------ Build started: Project: PartsProjectExample, Configuration: Debug Any CPU ------
      PartsProjectExample -> C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.dll
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\PartExampleDisplay.ascx
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\PartExampleEditor.ascx
      2 File(s) copied
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.dll
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.pdb
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.xml
      3 File(s) copied
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

    Without Administrator rights, the output will look something like this:

    ------ Build started: Project: PartsProjectExample, Configuration: Debug Any CPU ------
      PartsProjectExample -> C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.dll
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\PartExampleDisplay.ascx
      Access denied
      C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.dll
      Access denied
    c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3717,9): error MSB3073: The command "xcopy "C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\*.ascx" "C:\Program Files\Blackbaud\NetCommunity\Custom\PartsProjectExample" /s /I /y
    c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3717,9): error MSB3073: xcopy "C:\Users\TomTr\Documents\Visual Studio 2010\Projects\PartsProjectExample\PartsProjectExample\bin\PartsProjectExample.*" "C:\Program Files\Blackbaud\NetCommunity\Bin\" /y" exited with code 4.
    ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
  3. Browse to the files in Windows Explorer.