packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1/tools/net45/install.ps1
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
# Copyright (c) .NET Foundation. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
param($installPath, $toolsPath, $package, $project)
$roslynSubFolder = 'roslyn'
if ($project -eq $null) {
$project = Get-Project
}
$libDirectory = Join-Path $installPath 'lib\net45'
$projectRoot = $project.Properties.Item('FullPath').Value
$projectTargetFramework = $project.Properties.Item('TargetFrameworkMoniker').Value
$shouldUseRoslyn45 = $projectTargetFramework -match '4.5'
$binDirectory = Join-Path $projectRoot 'bin'
# We need to copy the provider assembly into the bin\ folder, otherwise
# Microsoft.VisualStudio.Web.Host.exe cannot find the assembly.
# However, users will see the error after they clean solutions.
New-Item $binDirectory -type directory -force | Out-Null
Copy-Item $libDirectory\* $binDirectory -force | Out-Null
# For Web Site, we need to copy the Roslyn toolset into
# the applicaiton's bin folder.
# For Web Applicaiton project, this is done in csproj.
if ($project.Type -eq 'Web Site') {
$packageDirectory = Split-Path $installPath
if($package.Versions -eq $null)
{
$compilerVersion = $package.Version
}
else
{
$compilerVersion = @($package.Versions)[0]
}
$compilerPackageFolderName = $package.Id + "." + $compilerVersion
$compilerPackageDirectory = Join-Path $packageDirectory $compilerPackageFolderName
if ((Get-Item $compilerPackageDirectory) -isnot [System.IO.DirectoryInfo])
{
Write-Host "The install.ps1 cannot find the installation location of package $compilerPackageName, or the pakcage is not installed correctly."
Write-Host 'The install.ps1 did not complete.'
break
}
if($shouldUseRoslyn45)
{
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools\roslyn45'
}
else
{
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools\roslynlatest'
}
$roslynSubDirectory = Join-Path $binDirectory $roslynSubFolder
New-Item $roslynSubDirectory -type directory -force | Out-Null
Copy-Item $compilerPackageToolsDirectory\* $roslynSubDirectory -force | Out-Null
# Generate a .refresh file for each dll/exe file.
后面还有 211 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
