Build PSGallery package with NuProj

PowerShell modules on PSGallery using PowerShellGet are just NuGet
packages but developers may not have PowerShellGet (WMF 5.0 or separate
MSI install for PSv3 and v4). Use NuProj as build-time dependency
instead.
This commit is contained in:
Heath Stewart 2017-01-14 15:43:17 -08:00
Родитель 1f6477a279
Коммит a58163daf9
9 изменённых файлов: 130 добавлений и 29 удалений

4
.nuget/packages.config Normal file
Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NuProj" version="0.11.14-beta" />
</packages>

44
CONTRIBUTING.md Normal file
Просмотреть файл

@ -0,0 +1,44 @@
Contributing
============
## Prerequisites
This project uses the following software. Newer versions may work but backward compatibility must be maintained.
* [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx)
### Optional
Some projects require optional software to open or otherwise use in Visual Studio. They are not required to build the solution using MSBuild.
* [NuProj Package Project](https://marketplace.visualstudio.com/items?itemName=NuProjTeam.NuGetPackageProject)
* [Visual Studio Spell Checker](https://marketplace.visualstudio.com/items?itemName=EWoodruff.VisualStudioSpellChecker)
## Building
Before you can build this project from the command line with MSBuild or within Visual Studio, you must restore packages.
* In Visual Studio, make sure Package Restore is enabled.
* On the command line and assuming _nuget.exe_ is in your `PATH`, in the solution directory run: `nuget restore`
Note again that to build the full solution in Visual Studio some optional software may be required.
## Testing
All available tests are discovered after a complete build in Test Explorer within Visual Studio.
On the command line, you can run the following commands from the solution directory. Replace `<version>` with whatever version was downloaded.
```
nuget install xunit.runner.console -outputdirectory packages
packages\xunit.runner.console.<version>\tools\xunit.runner.console test\VSSetup.PowerShell.Test\bin\Debug\Microsoft.VisualStudio.Setup.PowerShell.Test.dll
```
## Pull Requests
We welcome pull requests for both bug fixes and new features that solve a common enough problem to benefit the community. Please note the following requirements.
1. Code changes for bug fixes and new features are accompanied by new tests or, only if required, modifications to existing tests. Modifying existing tests when not required may introduce regressions.
2. All tests must pass. We have automated PR builds that will verify any PRs before they can be merged, but you are encouraged to run all tests in your development environment prior to pushing to your remote.
Thank you for your contributions!

Просмотреть файл

@ -3,8 +3,7 @@ Visual Studio Setup PowerShell Module
This PowerShell module contains cmdlets to query instances of Visual Studio 2017 and newer. It also serves as a more useful sample of using the Setup Configuration APIs than the previously [published samples](https://github.com/microsoft/vs-setup-samples) though those also have samples using VB and VC++.
Installing
----------
## Installing
You can download packages from the Releases page for this project on GitHub, but with Windows Management Framework 5.0 or newer (which installs PowerShell and comes with Windows 10), you can download and install this module even easier.
@ -12,8 +11,7 @@ You can download packages from the Releases page for this project on GitHub, but
Install-Module VSSetup -Scope CurrentUser
```
Using
-----
## Using
You can query all usable instances of Visual Studio and other products installed by the Visual Studio installer.
@ -33,7 +31,6 @@ If you want to select the latest instance that contains the .NET desktop develop
Get-VSSetupInstance -All | Select-VSSetupInstance -Require 'Microsoft.VisualStudio.Workload.ManagedDesktop' -Latest
```
Feedback
--------
## Feedback
To file issues or suggestions, please use the Issues page for this project on GitHub.

Просмотреть файл

@ -13,10 +13,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{73C57796-F
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9AD110B9-8C98-4003-A4DE-EDA52337735D}"
ProjectSection(SolutionItems) = preProject
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
EndProject
Project("{FF286327-C783-4F7A-AB73-9BCBAD0D4460}") = "VSSetup", "src\VSSetup\VSSetup.nuproj", "{E0172143-FCFD-48B3-988D-E9F01A680C21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -31,6 +34,10 @@ Global
{ED12C009-A3E6-4F22-999A-FCA8C84DB41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED12C009-A3E6-4F22-999A-FCA8C84DB41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED12C009-A3E6-4F22-999A-FCA8C84DB41A}.Release|Any CPU.Build.0 = Release|Any CPU
{E0172143-FCFD-48B3-988D-E9F01A680C21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0172143-FCFD-48B3-988D-E9F01A680C21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0172143-FCFD-48B3-988D-E9F01A680C21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0172143-FCFD-48B3-988D-E9F01A680C21}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -38,5 +45,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{F77937D9-8B7C-46AC-80D3-DFDE39EB3279} = {FEED13D9-C881-407F-A945-7555704789C0}
{ED12C009-A3E6-4F22-999A-FCA8C84DB41A} = {73C57796-F1DD-49D8-9A5D-9F58764C0078}
{E0172143-FCFD-48B3-988D-E9F01A680C21} = {FEED13D9-C881-407F-A945-7555704789C0}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -66,5 +66,6 @@
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1652" Action="None" />
</Rules>
</RuleSet>

Просмотреть файл

@ -14,7 +14,6 @@
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
<CodeAnalysisRuleSet>..\..\inc\Common.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -37,13 +36,6 @@
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.3.269-rc\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath>
@ -53,14 +45,10 @@
<Reference Include="System.Core" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.PowerShell.3.ReferenceAssemblies.1.0.0\lib\net4\System.Management.Automation.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Instance.cs" />
@ -110,7 +98,9 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets'))" />
<Error Condition="!Exists('..\..\packages\NuProj.Common.0.11.14-beta\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\NuProj.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NuProj.Common.0.11.14-beta\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\NuProj.Common.targets'))" />
</Target>
<Import Project="..\..\packages\NuProj.Common.0.11.14-beta\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\NuProj.Common.targets" Condition="Exists('..\..\packages\NuProj.Common.0.11.14-beta\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\NuProj.Common.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@ -118,4 +108,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Просмотреть файл

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.PowerShell.3.ReferenceAssemblies" version="1.0.0" targetFramework="net40-client" />
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.3.269-rc" targetFramework="net40-client" />
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.3.269-rc" targetFramework="net40-client" developmentDependency="true" />
<package id="Nerdbank.GitVersioning" version="1.5.62" targetFramework="net40-client" developmentDependency="true" />
<package id="NuProj.Common" version="0.11.14-beta" targetFramework="net40-client" developmentDependency="true" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="net40-client" developmentDependency="true" />
</packages>
</packages>

Просмотреть файл

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VSSetup.PowerShell\VSSetup.PowerShell.csproj">
<!-- Override behavior to add files to root directory -->
<PackageDirectory>\</PackageDirectory>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>e0172143-fcfd-48b3-988d-e9f01a680c21</ProjectGuid>
<NuProjPath>..\..\packages\nuproj.0.11.14-beta\tools</NuProjPath>
<VersionDependsOn>$(VersionDependsOn);GetNuPkgVersion</VersionDependsOn>
</PropertyGroup>
<PropertyGroup>
<NuProjPath Condition=" '$(NuProjPath)' == '' ">$(MSBuildExtensionsPath)\NuProj\</NuProjPath>
</PropertyGroup>
<Import Project="$(NuProjPath)\NuProj.props" Condition="Exists('$(NuProjPath)\NuProj.props')" />
<PropertyGroup Label="Configuration">
<Id>VSSetup</Id>
<Title>Visual Studio Setup PowerShell Module</Title>
<Authors>Microsoft Corporation</Authors>
<Owners>Microsoft Corporation</Owners>
<Summary>Visual Studio Setup PowerShell Module</Summary>
<Description>PowerShell module to interact with Visual Studio Setup</Description>
<ReleaseNotes>
</ReleaseNotes>
<ProjectUrl>https://github.com/Microsoft/vssetup.powershell</ProjectUrl>
<LicenseUrl>https://github.com/Microsoft/vssetup.powershell/raw/$GitCommitIdShort$/LICENSE.txt</LicenseUrl>
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
<Tags>PSModule PSIncludes_Cmdlet PSCmdlet_Get-VSSetupInstance PSCmdlet_Select-VSSetupInstance PSCommand_Get-VSSetupInstance PSCommand_Select-VSSetupInstance</Tags>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>
<ItemGroup>
<File Include="..\VSSetup.PowerShell\bin\$(Configuration)\VSSetup.psd1" />
<File Include="..\VSSetup.PowerShell\bin\$(Configuration)\VSSetup.types.ps1xml" />
</ItemGroup>
<Import Project="$(NuProjPath)\NuProj.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets'))" />
</Target>
<Import Project="..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.1.5.62\build\portable-net+win+wpa+wp+sl+netmf+MonoAndroid+MonoTouch+Xamarin.iOS\Nerdbank.GitVersioning.targets')" />
<Target Name="GetNuPkgVersion" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<!-- PSGallery packages must use dotted quad $(Version) -->
<Version>$(AssemblyFileVersion)</Version>
<NuSpecProperties>$(NuSpecProperties);GitCommitIdShort=$(GitCommitIdShort)</NuSpecProperties>
</PropertyGroup>
</Target>
</Project>

Просмотреть файл

@ -17,7 +17,6 @@
</TargetFrameworkProfile>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
<CodeAnalysisRuleSet>..\..\inc\Common.ruleset</CodeAnalysisRuleSet>
<NoWarn>$(NoWarn);CS1591;SA1600;SA1652</NoWarn>
</PropertyGroup>
@ -60,12 +59,7 @@
<HintPath>..\..\packages\Microsoft.PowerShell.3.ReferenceAssemblies.1.0.0\lib\net4\System.Management.Automation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
@ -128,4 +122,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>