Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matthieu Nelmes 102 posts 385 karma points
    Oct 30, 2015 @ 16:54
    Matthieu Nelmes
    1

    Visual Studio Solution Architecture for developing a package?

    A typical way I'd develop a site is by having my MVC project separate to an Umbraco website within my solution. I then have build events that copy the MVC built dll into the Umbraco bin directory.

    I really like this way of working but now I'm looking to have a bash at writing some packages and want to see how other people architect their solutions. I was thinking to take a similar approach where I have my web(MVC project) alongside a package(MVC) project that when built both copy their respective dll's into the Umbraco bin directory.

    In addition to the package dll I would also look to copy across all associated package manifest and all appropriate resources to the App_Plugins folder.

    Does this sound right? How do other people do this?

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Oct 30, 2015 @ 19:53
    Nicholas Westby
    1

    I am testing a technique that copies files using a grunt task: https://github.com/Nicholas-Westby/uformsia/blob/master/gruntfile.js

    In case somebody comes across this thread in the future and that file has changed, here are the contents:

    module.exports = function(grunt) {
    
        // Config variables.
        var projectName = "uformsia";
        var appProject = projectName + ".app";
    
        // Initialize Grunt tasks.
        grunt.initConfig({
            "pkg": grunt.file.readJSON('package.json'),
            copy: {
                main: {
                    files: [
                        {
                            // Frontend files.
                            expand: true,
                            src: ["App_Plugins/**"],
                            dest: 'Website/',
                            cwd: appProject + "/"
                        }, {
                            // Binaries.
                            expand: true,
                            src: [
                                appProject + ".dll",
                                appProject + ".pdb"
                            ],
                            dest: 'Website/bin/',
                            cwd: appProject + "/bin/Debug/"
                        }
                    ]
                }
            }
        });
    
        // Load NPM tasks.
        grunt.loadNpmTasks("grunt-contrib-copy");
    
        // Register Grunt tasks.
        grunt.registerTask("default", ["copy"]);
    
    };
    

    If one were so inclined, one could create a watcher that automatically copies files when they are changed.

    IIRC, I got the idea for this from Archetype, which is doing all kinds of neat stuff in the gruntfile.js: https://github.com/imulus/Archetype/blob/master/Gruntfile.js

    In order to make testing easy, I included a web project with Umbraco installed using NuGet. That way, I don't have to include most of the files, and people get a full Umbraco install by building the solution (thanks to NuGet package restore).

    Note that I currently have two solution files (one for the plugin, and one for the test website). I realize I could have gone with one, but I wanted to be sure to fully isolate them so I don't end up with (for example), and unintentional reference between the two of them. I did this both for myself and the hypothetical maintainers years down the road.

    By the way, that GitHub repo above isn't really a package yet. I'm just using it as a testbed to flesh out the architecture of the package I intend on building.

  • Mike B 14 posts 57 karma points
    Nov 12, 2015 @ 18:35
    Mike B
    0

    Hello and thank you for your insight on the matter, I have been trying to figure out the best setup and workflow too.

    What I can't figure though is how do you debug your code and hit breakpoints with 2 solutions?

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Nov 12, 2015 @ 20:04
    Nicholas Westby
    0

    Good point.

    For that, you'd probably just have to add the other project to the same solution as the website (and then reference the project rather than the built assembly). If there is just one project, that is easy. If there are multiple, that can be a pain.

  • Mike B 14 posts 57 karma points
    Nov 13, 2015 @ 14:40
    Mike B
    0

    That's unfortunate as I really really like your approach, it's just much more elegant! Oh well one can't have it all I guess

  • Matthieu Nelmes 102 posts 385 karma points
    Nov 02, 2015 @ 17:25
    Matthieu Nelmes
    0

    Thanks Nicholas,

    I'll take a look.

    In the mean-time I managed to get something working within VS2013 with build events (xcopy).

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Mar 29, 2016 @ 10:46
    Biagio Paruolo
    0

    Some updates?

  • Matthieu Nelmes 102 posts 385 karma points
    Mar 29, 2016 @ 10:58
    Matthieu Nelmes
    0

    VS Solution with

    • Umbraco (website)
    • Core MVC Logic (MVC Project)
    • Package logic and views (MVC Project)

    On build I have build events that get fired copying all relevant .dlls and view files into the Umbraco website project.

    Never got around to checking our the Grunt solution.

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Apr 13, 2017 @ 13:48
    Biagio Paruolo
    0

    MVC Project? Not Class Project?

  • Matthieu Nelmes 102 posts 385 karma points
    Apr 13, 2017 @ 13:51
    Matthieu Nelmes
    0

    Wow, this is on old thread!

    MVC for Models, Services, Controllers and ViewModels.

    The presentation stuff (actual Views) still stay within the Umbraco Website

Please Sign in or register to post replies

Write your reply to:

Draft