Skip to content

Commit e614826

Browse files
Some fixes to the previous 'Drop support for 4.5' and 'Treat non-web apps as first class' PRs (#133)
1 parent 1188f8a commit e614826

3 files changed

Lines changed: 28 additions & 17 deletions

File tree

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.nuproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
<NuGetContent Include="build\net472\*">
6666
<Destination>build\net472</Destination>
6767
</NuGetContent>
68+
<NuGetContent Include="tools\*.ps1" Condition="'$(SignAssembly)' != 'true'">
69+
<Destination>tools</Destination>
70+
</NuGetContent>
71+
<NuGetContent Include="tools\signed\*.ps1" Condition="'$(SignAssembly)' == 'true'">
72+
<Destination>tools</Destination>
73+
</NuGetContent>
6874
<NuGetContent Include="tools\$(LocalRoslyn46FolderName)\*">
6975
<Destination>tools\$(LocalRoslyn46FolderName)</Destination>
7076
</NuGetContent>

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/build/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@
2626

2727
<Target Name="LocateRoslynToolsDestinationFolder" Condition=" '$(RoslynToolsDestinationFolder)' == '' ">
2828
<!-- Choose one of WebProjectOutputDir or OutputPath -->
29-
<!-- But when OutDir is specified given and is different from the above, copy to OutDir as well -->
30-
<ItemGroup Condition="'$(WebProjectOutputDir)' != ''">
31-
<RoslynToolsDestinations Include="$(WebProjectOutputDir)\bin\roslyn" />
32-
<RoslynToolsDestinations Condition="'$(RoslynCopyToOutDir)' == 'true' AND '$(OutDir)' != '$(WebProjectOutputDir)'" Include="$(OutDir)\roslyn" />
33-
</ItemGroup>
34-
<ItemGroup Condition="'$(WebProjectOutputDir)' == ''">
35-
<RoslynToolsDestinations Include="$(OutputPath)\roslyn" />
36-
<RoslynToolsDestinations Condition="'$(RoslynCopyToOutDir)' == 'true' AND '$(OutDir)' != '$(OutputPath)'" Include="$(OutDir)\roslyn" />
37-
</ItemGroup>
29+
<PropertyGroup>
30+
<RoslynToolsDestinationFolder>$(WebProjectOutputDir)\bin\roslyn</RoslynToolsDestinationFolder>
31+
<RoslynToolsDestinationFolder Condition=" '$(WebProjectOutputDir)' == '' ">$(OutputPath)\roslyn</RoslynToolsDestinationFolder>
32+
</PropertyGroup>
33+
34+
<!-- But when OutDir is specified there as well -->
35+
<PropertyGroup Condition="'$(OutDir)' != ''">
36+
<RoslynToolsOutDirFolder>$(OutDir)\bin\roslyn</RoslynToolsOutDirFolder>
37+
<RoslynToolsOutDirFolder Condition=" '$(WebProjectOutputDir)' == '' ">$(OutDir)\roslyn</RoslynToolsOutDirFolder>
38+
</PropertyGroup>
3839
</Target>
3940

4041
<Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder;SetRoslynCompilerFiles">
41-
<Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="%(RoslynToolsDestinations.FullPath)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
42+
<Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(RoslynToolsDestinationFolder)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
4243
<ItemGroup Condition="'$(MSBuildLastTaskResult)' == 'True'" >
4344
<FileWrites Include="$(RoslynToolsDestinationFolder)\*" />
4445
</ItemGroup>
46+
<Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(RoslynToolsOutDirFolder)" Condition="'$(RoslynToolsOutDirFolder)' != '$(RoslynToolsDestinationFolder)'" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
47+
<ItemGroup Condition="'$(RoslynToolsOutDirFolder)' != '$(RoslynToolsDestinationFolder)' AND '$(MSBuildLastTaskResult)' == 'True'" >
48+
<FileWrites Include="$(RoslynToolsOutDirFolder)\*" />
49+
</ItemGroup>
4550
</Target>
4651

4752
<Target Name="CheckIfShouldKillVBCSCompiler" DependsOnTargets="LocateRoslynCompilerFiles;LocateRoslynToolsDestinationFolder">

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/tools/install.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if ($project -eq $null) {
1515
$project = Get-Project
1616
}
1717

18-
$libDirectory = Join-Path $installPath 'lib\net46'
18+
$libDirectory = Join-Path $installPath 'lib\net462'
1919
$projectRoot = $project.Properties.Item('FullPath').Value
2020
$projectTargetFramework = $project.Properties.Item('TargetFrameworkMoniker').Value
2121
$binDirectory = Join-Path $projectRoot 'bin'
@@ -68,17 +68,17 @@ $vbCodeDomProvider = [CodeDomProviderDescription]@{
6868
InstallCodeDomProvider $vbCodeDomProvider
6969

7070

71-
# We need to copy the provider assembly into the bin\ folder, otherwise
72-
# Microsoft.VisualStudio.Web.Host.exe cannot find the assembly.
73-
# However, users will see the error after they clean solutions.
74-
New-Item $binDirectory -type directory -force | Out-Null
75-
Copy-Item $libDirectory\* $binDirectory -force | Out-Null
76-
7771
# For Web Site, we need to copy the Roslyn toolset into
7872
# the applicaiton's bin folder.
7973
# For Web Applicaiton project, this is done in csproj.
8074
if ($project.Type -eq 'Web Site') {
8175

76+
# We need to copy the provider assembly into the bin\ folder, otherwise
77+
# Microsoft.VisualStudio.Web.Host.exe cannot find the assembly.
78+
# However, users will see the error after they clean solutions.
79+
New-Item $binDirectory -type directory -force | Out-Null
80+
Copy-Item $libDirectory\* $binDirectory -force | Out-Null
81+
8282
if ((Get-Item $compilerPackageDirectory) -isnot [System.IO.DirectoryInfo])
8383
{
8484
Write-Host "The install.ps1 cannot find the installation location of package $compilerPackageName, or the pakcage is not installed correctly."

0 commit comments

Comments
 (0)