|
1 | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | 2 | <Import Project="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Extensions.targets"/> |
3 | 3 |
|
| 4 | + <PropertyGroup> |
| 5 | + <RoslynCopyToOutDir>true</RoslynCopyToOutDir> |
| 6 | + </PropertyGroup> |
| 7 | + |
4 | 8 | <Target Name="SetRoslynCompilerFiles" DependsOnTargets="LocateRoslynCompilerFiles"> |
5 | 9 | <Message Text="Using Roslyn from '$(RoslynToolPath)' folder" /> |
6 | 10 | <ItemGroup> |
|
21 | 25 | </Target> |
22 | 26 |
|
23 | 27 | <Target Name="LocateRoslynToolsDestinationFolder" Condition=" '$(RoslynToolsDestinationFolder)' == '' "> |
24 | | - <PropertyGroup> |
25 | | - <RoslynToolsDestinationFolder>$(WebProjectOutputDir)\bin\roslyn</RoslynToolsDestinationFolder> |
26 | | - <RoslynToolsDestinationFolder Condition=" '$(WebProjectOutputDir)' == '' ">$(OutputPath)\roslyn</RoslynToolsDestinationFolder> |
27 | | - </PropertyGroup> |
| 28 | + <!-- Choose one of WebProjectOutputDir or OutputPath --> |
| 29 | + <!-- But when OutDir is specified given and is different from that choice, also include it without 'bin' --> |
| 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)\bin\roslyn" /> |
| 36 | + <RoslynToolsDestinations Condition="'$(RoslynCopyToOutDir)' == 'true' AND '$(OutDir)' != '$(OutputPath)'" Include="$(OutDir)\roslyn" /> |
| 37 | + </ItemGroup> |
28 | 38 | </Target> |
29 | 39 |
|
30 | 40 | <Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder;SetRoslynCompilerFiles"> |
31 | | - <Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(RoslynToolsDestinationFolder)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" /> |
| 41 | + <Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="%(RoslynToolsDestinations.FullPath)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" /> |
32 | 42 | <ItemGroup Condition="'$(MSBuildLastTaskResult)' == 'True'" > |
33 | 43 | <FileWrites Include="$(RoslynToolsDestinationFolder)\*" /> |
34 | 44 | </ItemGroup> |
|
0 commit comments