Get started

This tutorial helps you get started creating your first Weavy extension using C# on .NET.

To develop and deploy your extension you need to:

Get prerequisites

To complete this tutorial, you need to get the following tools:

If you see an option to add git to the PATH during installation, choose to do so. It will be handy.

Make sure to launch Visual Studio 2017 and install any updates if shown.

Download Weavy

We provide a Visual studio solution to get you started. In a terminal window, run the following command to clone the repository to your local machine:

C:\Projects> git clone https://github.com/weavy/weavy-sln.git

Instead of cloning, you can fork this repo if you want to modify and check in your changes to GitHub for future reference.

Create database

Open SQL Server Management studio and create a new database named weavy.

Build and run the solution

Once the repo is cloned and the database is created, use Visual Studio to open the solution file Wvy.sln from the root directory of the repo and click Build Solution from the Build menu. You can also run the project by pressing F5 or choosing Start Debugging from the Debug menu.

When the app starts, you will see a browser window open with the setup wizard launched. After completing the setup you will be logged in to Weavy.

Create your extension

Once logged in you should navigate to the /manage section. Among other things you will be presented with a list of all built-in extensions (apps, content types, hooks, daemons, and tools). In this tutorial we will add a new content type which will later be listed under available Content Types.

In your Visual Studio solution, create a new file in the Models folder with the following content:

using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.InteropServices;
using System.Web.Mvc;
using Weavy.Core.Models;

namespace Wvy.Models {

    [Serializable]
    [Guid("D16FE490-AB4D-4D42-B9F4-D93E6F297940")]
    [Content(Icon = "clipboard-text", Name = "Meeting note", Description = "Keep your notes organized with this meeting minutes template.", Parents = new Type[] { typeof(FilesApp), typeof(Folder) })]
    public class MeetingMinutes : ItemBase {

        public string Location { get; set; }

        [Display(Name = "Date", Description = "Date and time of the meeting")]
        public DateTime? Date { get; set; }

        public string Attendees { get; set; }
        
        [AllowHtml]
        [Required]
        [DataType(DataType.Html)]
        [Display(Name = "Note text")]
        public string Body { get; set; }
    }
}

Then build and run the application again by pressing F5. Your new content type should now be listed under /manage/content.

Test your extension

To see your new content type in action you first have to add add the Files app to a space.

  1. Create a Space
  2. Add the Files app

Next, while in the Files app, click the FAB button in the lower right hand corner to add a new Meeting minutes document. You will now be presented with a page for writing your Meeting minutes.

Publish your solution

Now that you created and verified that your extension is working the way it should, the next step is to publish a deployment package. To do that you should first open a command prompt and run the build.cmd command. This will create a deployment package with a precompiled version of your customized Weavy solution in the dist folder.

C:\Projects\weavy-sln> build.cmd
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring Nuget packages  
  Publishing project
  ...
  Merging precompiled views
  Creating deployment package
  Deployment package -> C:\Projects\weavy-sln\dist\wvy-1.0.6863.29173.zip

Once the deployment package is created you should upload it to the management portal where it can be deployed to your Weavy instances.