-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionally deploy Roslyn dependencies #8086
Merged
DustinCampbell
merged 3 commits into
dotnet:main
from
DustinCampbell:conditionally-deploy-roslyn-deps
Jan 10, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
@ECHO OFF | ||
SETLOCAL | ||
@echo off | ||
setlocal | ||
|
||
:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET Core SDK. | ||
|
||
:: This tells .NET Core to use the same dotnet.exe that build scripts use | ||
SET DOTNET_ROOT=%~dp0.dotnet | ||
SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86 | ||
|
||
:: This tells .NET Core not to go looking for .NET Core in other places | ||
SET DOTNET_MULTILEVEL_LOOKUP=0 | ||
|
||
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use | ||
SET PATH=%DOTNET_ROOT%;%PATH% | ||
|
||
SET sln=%~1 | ||
|
||
IF "%sln%"=="" ( | ||
SET sln=%~dp0\Razor.sln | ||
) | ||
|
||
IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" ( | ||
echo .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools | ||
exit /b 1 | ||
) | ||
|
||
start "" "%sln%" | ||
powershell -ExecutionPolicy ByPass -NoProfile -Command "& '%~dp0startvs.ps1'" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[CmdletBinding(PositionalBinding=$true)] | ||
Param( | ||
[Parameter( | ||
Position=0, | ||
Mandatory=$false, | ||
HelpMessage="Solution file to open. The default is 'Razor.sln'.")] | ||
[string]$solutionFile=$null, | ||
|
||
[Parameter( | ||
Mandatory=$false, | ||
HelpMessage="If specified, choose the Visual Studio version from a list before laucnhing. By default the newest and last installed Visual Studio instance will be launched.")] | ||
[Switch]$chooseVS, | ||
|
||
[Parameter( | ||
Mandatory=$false, | ||
HelpMessage="If specified, Roslyn dependencies will be included in the Razor extension when deployed.")] | ||
[Switch]$includeRoslynDeps | ||
) | ||
|
||
if ($solutionFile -eq "") { | ||
$solutionFile = "Razor.sln" | ||
} | ||
|
||
if ($includeRoslynDeps) { | ||
# Setting this environment variable ensures that the MSBuild will see it when | ||
# building from inside Visual Studio. | ||
$env:IncludeRoslynDeps = $true | ||
} | ||
|
||
$dotnetPath = Join-Path (Get-Location) ".dotnet" | ||
|
||
# This tells .NET Core to use the same dotnet.exe that build scripts use | ||
$env:DOTNET_ROOT = $dotnetPath | ||
${env:DOTNET_ROOT(x86)} = Join-Path $dotnetPath "x86" | ||
|
||
# This tells .NET Core not to go looking for .NET Core in other places | ||
$env:DOTNET_MULTILEVEL_LOOKUP = 0 | ||
|
||
# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use | ||
$env:PATH = $env:DOTNET_ROOT + ";" + $env:PATH | ||
|
||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | ||
|
||
if ($chooseVS) { | ||
# Launch vswhere.exe to retrieve a list of installed Visual Studio instances | ||
$vsInstallsJson = &$vswhere -prerelease -format json | ||
$vsInstalls = $vsInstallsJson | ConvertFrom-Json | ||
|
||
# Display a menu of Visual Studio instances to the user | ||
Write-Host "" | ||
|
||
$index = 1 | ||
|
||
foreach ($vsInstall in $vsInstalls) { | ||
$channelId = $vsInstall.installedChannelId | ||
$lastDotIndex = $channelId.LastIndexOf(".") | ||
$channelName = $channelId.Substring($lastDotIndex + 1); | ||
|
||
Write-Host " $($index) - $($vsInstall.displayName) ($($vsInstall.installationVersion) - $($channelName))" | ||
$index += 1 | ||
} | ||
|
||
Write-Host "" | ||
$choice = [int](Read-Host "Choose a Visual Studio version to launch") | ||
|
||
$vsBasePath = $vsInstalls[$choice - 1].installationPath | ||
} | ||
else { | ||
# Launch vswhere.exe to retrieve the newest, last installed Visual Studio instance | ||
$vsBasePath = &$vswhere -prerelease -latest -property installationPath | ||
} | ||
|
||
$vsPath = Join-Path $vsBasePath "Common7\IDE\devenv.exe" | ||
|
||
Start-Process $vsPath -ArgumentList $solutionFile |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why spare these from conditionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they existed before the change to fix VS integration tests. To my knowledge, there haven't been any failures due to these. If we find that these are problematic, we can address them separately. However, since they don't actually contain behavior, I suspect that they'll be OK.