parent
28ab31eb1d
commit
3ba44f5038
|
|
@ -1,2 +0,0 @@
|
|||
@ECHO OFF
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build-vsix.ps1' %*; exit $LASTEXITCODE"
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
#requires -version 4
|
||||
param(
|
||||
[string]$MSBuildPath,
|
||||
[string]$Configuration='Debug',
|
||||
[string]$VsixName='Microsoft.VisualStudio.RazorExtension.vsix'
|
||||
)
|
||||
$ErrorActionPreference='Stop'
|
||||
########################
|
||||
# Helpers
|
||||
########################
|
||||
|
||||
function exec($cmd) {
|
||||
$cmdName = [IO.Path]::GetFileName($cmd)
|
||||
Write-Host -ForegroundColor Cyan "> $cmdName $args"
|
||||
& $cmd @args
|
||||
$exitCode = $LASTEXITCODE
|
||||
if($exitCode -ne 0) {
|
||||
throw "'$cmdName $args' failed with exit code: $exitCode"
|
||||
}
|
||||
}
|
||||
|
||||
function Get-BuildConfiguration {
|
||||
if ($env:Configuration) {
|
||||
return $env:Configuration
|
||||
}
|
||||
return $Configuration
|
||||
}
|
||||
|
||||
function Get-MSBuildPath {
|
||||
if ($MSBuildPath) {
|
||||
return $MSBuildPath
|
||||
}
|
||||
|
||||
$vsDir=$ENV:VSINSTALLDIR
|
||||
if (!($vsDir)) {
|
||||
$vsDir = Join-Path ${ENV:ProgramFiles(x86)} 'Microsoft Visual Studio/2017*/*'
|
||||
}
|
||||
|
||||
$msbuild = Get-ChildItem $(Join-Path $vsDir 'MSBuild/15.0/bin/MSBuild.exe')
|
||||
|
||||
if (!($msbuild) -or ($msbuild | Measure-Object).Count -ne 1) {
|
||||
throw "MSBuild 15.0 could not be located automatically in '$vsDir'. Use -MSBuildPath to specify its location."
|
||||
}
|
||||
|
||||
return $msbuild
|
||||
}
|
||||
|
||||
########################
|
||||
# Variables
|
||||
########################
|
||||
|
||||
$intermediateDir = Join-Path $PSScriptRoot 'obj'
|
||||
$nugetExePath = Join-Path $intermediateDir 'nuget.exe'
|
||||
$artifactsDir = Join-Path $PSScriptRoot 'artifacts'
|
||||
$buildDir = Join-Path $artifactsDir 'build'
|
||||
$vsixPath = Join-Path $buildDir $VsixName
|
||||
$msbuildDir = Join-Path $artifactsDir 'msbuild'
|
||||
$logPath = Join-Path $msbuildDir 'vsix-msbuild.log'
|
||||
$vsixCsproj = Join-Path $PSScriptRoot 'tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj'
|
||||
$msbuild = Get-MSBuildPath
|
||||
$config = Get-BuildConfiguration
|
||||
|
||||
########################
|
||||
# Main
|
||||
########################
|
||||
|
||||
exec .\build.ps1 initialize
|
||||
|
||||
mkdir $buildDir -ErrorAction Ignore | out-null
|
||||
mkdir $msbuildDir -ErrorAction Ignore | out-null
|
||||
mkdir $intermediateDir -ErrorAction Ignore | out-null
|
||||
|
||||
if (!(Test-Path $nugetExePath))
|
||||
{
|
||||
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v4.0.0-rc4/NuGet.exe" -OutFile "$nugetExePath"
|
||||
}
|
||||
|
||||
exec $nugetExePath restore $vsixCsproj -SolutionDirectory $PSScriptRoot -Verbosity quiet
|
||||
exec $msbuild $vsixCsproj `
|
||||
/v:m `
|
||||
/p:DeployExtension=false `
|
||||
/fl "/flp:v=D;LogFile=$logPath" `
|
||||
/p:TargetVsixContainer=$vsixPath `
|
||||
/p:Configuration=$config
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<PackageDependsOn Condition="'$(OS)'=='Windows_NT'">$(PackageDependsOn);GenerateVSIX</PackageDependsOn>
|
||||
<NuGetCommandLineVersion>3.5.0</NuGetCommandLineVersion>
|
||||
<VSIXName>Microsoft.VisualStudio.RazorExtension</VSIXName>
|
||||
<VSIXProject>$(RepositoryRoot)tooling\$(VSIXName)\$(VSIXName).csproj</VSIXProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NuGet.CommandLine" Version="$(NuGetCommandLineVersion)" Condition="'$(OS)'=='Windows_NT'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target
|
||||
Name="GenerateVSIX"
|
||||
DependsOnTargets="_LocateMSBuildExe;_BuildVSIX"
|
||||
Condition="'$(OS)'=='Windows_NT'" />
|
||||
|
||||
<Target Name="_LocateMSBuildExe" Condition="Exists('$(MSBuildProgramFiles32)')">
|
||||
<ItemGroup>
|
||||
<MSBuild15ExePaths Include="$(MSBuildProgramFiles32)\Microsoft Visual Studio\2017*\**\MSBuild\15.0\Bin\MSBuild.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<Warning
|
||||
Text="Unable to locate MSBuild 15.0 under $(MSBuildProgramFiles32)\Microsoft Visual Studio"
|
||||
Condition="'@(MSBuild15ExePaths)'==''"/>
|
||||
|
||||
<PropertyGroup Condition="'@(MSBuild15ExePaths)'!=''">
|
||||
<MSBuildExePath>%(MSBuild15ExePaths.FullPath)</MSBuildExePath>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_RestoreProject">
|
||||
<PropertyGroup>
|
||||
<NuGetExe>$(NuGetPackageFolders)nuget.commandline\$(NuGetCommandLineVersion)\tools\nuget.exe</NuGetExe>
|
||||
</PropertyGroup>
|
||||
<Exec Command="$(NuGetExe) restore "$(VSIXProject)" -SolutionDir "$(RepositoryRoot) " -verbosity quiet" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_BuildVSIX" Condition="'$(MSBuildExePath)'!=''">
|
||||
<PropertyGroup>
|
||||
<VSIXLogFilePath>$(ArtifactsDir)msbuild\vsix.log</VSIXLogFilePath>
|
||||
<VSIXResponseFilePath>$(ArtifactsDir)msbuild\vsix.rsp</VSIXResponseFilePath>
|
||||
<VSIXOutputPath>$(BuildDir)$(VSIXName).vsix</VSIXOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<CallTarget Targets="_RestoreProject" />
|
||||
<ItemGroup>
|
||||
<MSBuildArguments Include="
|
||||
$(VSIXProject);
|
||||
/v:M;
|
||||
/fl;
|
||||
/flp:LogFile=$(VSIXLogFilePath);
|
||||
/p:DeployExtension=false;
|
||||
/p:TargetVSIXContainer=$(VSIXOutputPath);
|
||||
/p:Configuration=$(Configuration);" />
|
||||
</ItemGroup>
|
||||
|
||||
<WriteLinesToFile
|
||||
File="$(VSIXResponseFilePath)"
|
||||
Lines="@(MSBuildArguments)"
|
||||
Overwrite="true" />
|
||||
|
||||
<Exec Command=""$(MSBuildExePath)" @"$(VSIXResponseFilePath)"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
<Project>
|
||||
<!--
|
||||
TODO include VSIX build in default lifecycle builds
|
||||
The .NET Core SDK doesn't currently support Microsoft.VsSDK.targets.
|
||||
-->
|
||||
<Import Project="VSIX.targets" />
|
||||
<ItemGroup>
|
||||
<Solutions Update="..\Razor.sln">
|
||||
<!-- the 'DebugNoVSIX' and 'ReleaseNoVSIX' configurations exclude the VSIX project, which doesn't build with Microsoft.NET.Sdk yet. -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue