Search code examples
powershellvisual-studio-2015packaging

VS2015: What is the best way to setup a Powershell module solution?


What I have:

  • vs2015
  • several class library projects in my solution
  • module manifest(psd1) and scripts(ps1) that I don't know where to put yet

What I need:

  • After build I need to have a folder(MyModule) with the class libraries and some static files: powershell module manifest(psd1) and scripts(ps1)
  • I don't want to set a postbuild for the class libraries since their project purpose is to create an assembly
  • The best solution for me will be to have some kind of project that depends on the CL projects and outputs a folder with the static files and CL DLLs.

Note: PowerShell module project in VS2015 would be perfect for me if it had "Postbuild" capabilities. Unfortunately it has not.


Solution

  • I would use a Makefile project (New \ Project \ Templates \ Visual C++ \ General \ Makefile Project). Go to its Properties \ NMake tab and compose "Build Command Line" and other commands, as required. In your case, the build command should copy needed files to the target location. Do not be confused by names "Visual C++" and "NMake". You can use any commands you want.

    Finally, in a solution configure project dependencies or build order with this new project included.