Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test the template (request for documentation) #107

Open
2 tasks done
oesolberg opened this issue Dec 11, 2018 · 2 comments
Open
2 tasks done

How to test the template (request for documentation) #107

oesolberg opened this issue Dec 11, 2018 · 2 comments

Comments

@oesolberg
Copy link
Contributor

Summary

I would like some documentation about how I can test the template if I do changes and compile it at home.

Context

I would like to try to implement some changes that I would like to have

Your Environment

  • Developer environment: Visual Studio 2017

Checklist

  • I have read the CODE OF CONDUCT document.
  • I have searched the issues_ list and could not find a similar issue to this one.
@alexdresko
Copy link
Owner

@oesolberg I posted in gitter here but I'll make sure to include that information in the official documentation.

@oesolberg
Copy link
Contributor Author

Just adding the answer here for future reference

For each template that HSPI provides, there are two projects: For example, HSPIPluginA and HSPIPluginA.Dev. HSPIPluginA is the actual template, but it is not a runnable application. HSPIPluginA.Dev is a runnable, HS plugin. You can set your startup project be HSPIPluginA.Dev and F5 to start up an instance of that plugin.
The HomeSeerTemplates project is the Visual Studio extension project. It references the HSPIPluginA template. So if you set your startup project to HomeSeerTemplates and F5, it will start up a new instance of Visual Studio with your local HSPI code installed. From there, you'll be able to File>New and create a HSPI project that uses your modified templates.
That being said, there are some things you need to know. If you look closely at the differences between HSPIPluginA and HSPIPluginA.Dev, you'll see some interesting things. For example in HSPI.cs in HSPIPluginA.Dev, you'll see this:

    protected override string GetName()
    {
        //TODO: return "$projectname$";
        return "HSPIPluginA.Dev";
    }

When you compile HomeSeerTemplates, it runs a script that copies HSPI.cs from HSPIPluginA.Dev to HSPIPluginA and replaces return "HSPIPluginA.Dev"; with return "$projectname$"; where $projectname$ is the name of the project specified when you created the new project.

I.E., those //TODO:... comments in the .Dev projects are important.

Also, if you add new files to the .Dev projects, you'll need to adjust the .vstemplate and .csproj files in the corresponding template projects. https://docs.microsoft.com/en-us/visualstudio/ide/creating-project-and-item-templates?view=vs-2017 might be a useful starting point if you need to do anything special with the VS template projects.
Just to clarify some terminology there... HomeSeerTemplates is a VS extension project. HSPIPluginA is a VS template project (referenced by the VS extension project). HSPIPluginA.Dev is a helper project that makes testing the HS plugin code easier. Ultimately, the .Dev code is automatically copied to the corresponding VS template project to keep the two in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants