Powershell 工具模块项目构建无法正常工作
Powershell Tools module project build not working correctly
我在 Visual Studio 2015 中的 Powershell 工具项目定义如下:
<?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>
当我构建整个解决方案时 "Build" 没有执行任务 Exec 命令。为什么?
当我使用 msbuild 控制台应用程序构建它时,它会成功并执行 "Build" 任务执行命令,但是 "Build command" 在 Visual Studio 2015 社区当我右键单击解决方案资源管理器上的项目节点时,不会为该项目显示。如何启用此功能?
我已经添加了节点 <Target Name="CoreCompile" />
但没有效果 - 该命令仍未显示在 UI 中。 XML 中还缺少什么吗?
PowerShell 工具扩展未定义 Visual Studio 命令到 "build" PowerShell 模块项目。如果您在解决方案资源管理器中右键单击该项目,您会发现没有生成选项。
但是,在“构建”菜单下有一个选项。我认为这只是 Visual Studio 的标准 chrome,而不是扩展提供商的行为。因为单击此按钮本质上是空操作。
目前,msbuild 是完成您需要的工具。
我在 Visual Studio 2015 中的 Powershell 工具项目定义如下:
<?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>
当我构建整个解决方案时 "Build" 没有执行任务 Exec 命令。为什么?
当我使用 msbuild 控制台应用程序构建它时,它会成功并执行 "Build" 任务执行命令,但是 "Build command" 在 Visual Studio 2015 社区当我右键单击解决方案资源管理器上的项目节点时,不会为该项目显示。如何启用此功能?
我已经添加了节点 <Target Name="CoreCompile" />
但没有效果 - 该命令仍未显示在 UI 中。 XML 中还缺少什么吗?
PowerShell 工具扩展未定义 Visual Studio 命令到 "build" PowerShell 模块项目。如果您在解决方案资源管理器中右键单击该项目,您会发现没有生成选项。
但是,在“构建”菜单下有一个选项。我认为这只是 Visual Studio 的标准 chrome,而不是扩展提供商的行为。因为单击此按钮本质上是空操作。
目前,msbuild 是完成您需要的工具。