Nmktronas
Nmktronas

Reputation: 237

Powershell Tools module project build not working correctly

I have Powershell Tools project in Visual Studio 2015 defined like this:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>6CAFC0C6-A428-4d30-A9F9-700E829FEA51</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>MyApplication</RootNamespace>
    <AssemblyName>MyApplication</AssemblyName>
    <Name>PS.TEST</Name>
    <DebugArguments>
    </DebugArguments>
    <Author />
    <CompanyName />
    <Copyright />
    <Description />
    <Version>1.0.0.1</Version>
    <Guid>29a8500a-c449-43f5-b9ba-610546db8cc2</Guid>
    <FormatsToProcess />
    <FunctionsToProcess />
    <ModuleList>
    </ModuleList>
    <ModuleToProcess />
    <NestedModules />
    <TypesToProcess />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="PS-TEST.psd1" />
    <Compile Include="PS-TEST.psm1" />
    <Compile Include="Tools\Release.ps1" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Files\" />
    <Folder Include="Tools\" />
    <Folder Include="Public\" />
    <Folder Include="Private\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Target Name="CoreCompile" />
  <Target Name="Build">
    <Exec Command="Powershell.exe Tools\Release.ps1 $(version)" />
  </Target>
</Project>

When I build whole solution "Build" task Exec command is not performed. Why?

When I build this with msbuild console application it succeeds and performs "Build" task Exec command, however "Build command" in Visual Studio 2015 Community is not displayed for this project when I right click the project node on solution explorer. How to enable this?

I've already added node <Target Name="CoreCompile" /> but no effect - the command is still not shown in the UI. Is there something still missing in the XML?

Upvotes: 2

Views: 625

Answers (1)

Jake Bruun
Jake Bruun

Reputation: 1323

The PowerShell Tools extension does not define a Visual Studio command to "build" a PowerShell module project. If you right click the project in the solution explorer you'll notice there is no build option.

However, there is an option beneath the Build menu. I assume that this is just standard chrome of Visual Studio, not the doing of the extension provider. Because clicking this is essentially a no-op.

Currently, msbuild is the tool to accomplish what you need.

You can file an issue here: https://github.com/adamdriscoll/poshtools/issues

Upvotes: 1

Related Questions