Search code examples
asp.net-mvcasp.net-mvc-scaffolding

How do I deploy custom scaffolder into an existing mvc project?


I am experimenting with custom scaffolders, using this tutorial: https://blogs.msdn.microsoft.com/webdev/2014/04/03/creating-a-custom-scaffolder-for-visual-studio/

I have created my scaffolder and it builds. Pressing f5 gives me a new VS instance in which I create a project and test my scaffolder. It works :)

But I am at a loss as to what to do next. I haven't been able to find any tutorials / guidance / information on how to proceed from this point

How do I deploy it into an existing project?


What I've Tried

Because the BasicScaffolder project outputs a class library, I tried to import this as a reference in another project. But there is no dll in /bin/Release.

Do I need to perform an extra step to create this file?

Is this the correct way to deploy the scaffolder into an existing project?


Solution

  • So I found out how to do this finally. I'm sharing the info here in case it's of help to anybody.

    The scaffolding solution contains 2 projects - CustomScaffolder and CustomScaffolderExtension. The CustomScaffolderExtension project has /bin/debug and /bin/release directories. These contain .visx files that can be installed as extensions to VS.

    There were 2 things that tripped me up getting it working:

    Firstly - setting the build as either debug or release. This is set in Build > Configuration Manager. Choose debug or release as required.

    Secondly - getting the extension to install in my version of VS. To do this I had to set the release target(s) property of the Extension. I did this in the source.extension.vsixmanifest file in the CustomScaffolderExtension project.

    By default in the SideWaffle template that I used this was set only to target Pro 12.2. I use VS Community 2015 so I changed the value to target community version and set the range to [12.2,14.0]. (14.0 is the version number of community 2015).

    I could then go to ~/bin/release/, click on CustomScaffolderExtension.visx and install the extension.