Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/test-rebuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ try {

if ($bootstrap) {
Write-Host "Building Roslyn"
& eng/build.ps1 -restore -build -bootstrap -prepareMachine:$prepareMachine -ci:$ci -useGlobalNuGetCache:$useGlobalNuGetCache -configuration:$configuration -pack -binaryLog
& eng/build.ps1 -restore -build -bootstrap -prepareMachine:$prepareMachine -ci:$ci -useGlobalNuGetCache:$useGlobalNuGetCache -configuration:$configuration -pack -binaryLog /p:RoslynCompilerType=Framework
Test-LastExitCode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@
<Project>

<PropertyGroup>
<_RoslynTargetDirectoryName Condition="'$(MSBuildRuntimeType)' == 'Core'">netcore</_RoslynTargetDirectoryName>
<_RoslynTargetDirectoryName Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</_RoslynTargetDirectoryName>
<_RoslynTasksDirectory>$(MSBuildThisFileDirectory)..\tasks\$(_RoslynTargetDirectoryName)\</_RoslynTasksDirectory>
<!--
Even on netfx hosts we want to use netcore compiler to be consistent with SDK's behavior since .NET 10.
The opt out is also the same as in SDK - setting RoslynCompilerType=Framework.
-->
<_UseRoslynBridgeTask Condition="'$(MSBuildRuntimeType)' != 'Core' and '$(RoslynCompilerType)' != 'Framework'">true</_UseRoslynBridgeTask>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the user meant to be able to put <RoslynCompilerType>Framework</RoslynCompilerType> in their project, in addition to PackageReference to MS.Net.Compilers.Toolset, and expect the toolset compiler to run on framework?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Although one needs to ensure it's put before the package props are imported (so putting inside Directory.Build.props would work; or manually before <Import Sdk> element; or just as /p: command-line arg, etc).


<!-- Directory with .targets files. -->
<_RoslynTargetsDirectoryName Condition="'$(MSBuildRuntimeType)' == 'Core'">netcore</_RoslynTargetsDirectoryName>
<_RoslynTargetsDirectoryName Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</_RoslynTargetsDirectoryName>
<_RoslynTargetsDirectory>$(MSBuildThisFileDirectory)..\tasks\$(_RoslynTargetsDirectoryName)\</_RoslynTargetsDirectory>

<!-- Directory with BuildTask DLL. -->
<_RoslynTasksDirectoryName Condition="'$(_UseRoslynBridgeTask)' == 'true'">netcore\binfx</_RoslynTasksDirectoryName>
<_RoslynTasksDirectoryName Condition="'$(_RoslynTasksDirectoryName)' == ''">$(_RoslynTargetsDirectoryName)</_RoslynTasksDirectoryName>
<_RoslynTasksDirectory>$(MSBuildThisFileDirectory)..\tasks\$(_RoslynTasksDirectoryName)\</_RoslynTasksDirectory>

<RoslynCompilerType>Custom</RoslynCompilerType>
<RoslynCoreAssembliesPath>$(_RoslynTasksDirectory)bincore\</RoslynCoreAssembliesPath>

<!-- .NET Core compiler assemblies. -->
<RoslynCoreAssembliesPath Condition="'$(_UseRoslynBridgeTask)' != 'true'">$(_RoslynTasksDirectory)bincore\</RoslynCoreAssembliesPath>
<RoslynCoreAssembliesPath Condition="'$(_UseRoslynBridgeTask)' == 'true'">$(_RoslynTasksDirectory)..\bincore\</RoslynCoreAssembliesPath>

<!-- Framework/Core (depending on the host) compiler assemblies. -->
<RoslynAssembliesPath Condition="'$(RoslynAssembliesPath)' == '' and '$(MSBuildRuntimeType)' == 'Core'">$(RoslynCoreAssembliesPath)</RoslynAssembliesPath>
<RoslynAssembliesPath Condition="'$(RoslynAssembliesPath)' == '' and '$(MSBuildRuntimeType)' != 'Core'">$(_RoslynTasksDirectory)</RoslynAssembliesPath>
<RoslynTasksAssembly>$(_RoslynTasksDirectory)Microsoft.Build.Tasks.CodeAnalysis.dll</RoslynTasksAssembly>

<RoslynTasksAssembly Condition="'$(_UseRoslynBridgeTask)' != 'true'">$(_RoslynTasksDirectory)Microsoft.Build.Tasks.CodeAnalysis.dll</RoslynTasksAssembly>
<RoslynTasksAssembly Condition="'$(_UseRoslynBridgeTask)' == 'true'">$(_RoslynTasksDirectory)Microsoft.Build.Tasks.CodeAnalysis.Sdk.dll</RoslynTasksAssembly>
<UseSharedCompilation Condition="'$(UseSharedCompilation)' == ''">true</UseSharedCompilation>
<CSharpCoreTargetsPath>$(_RoslynTasksDirectory)Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
<VisualBasicCoreTargetsPath>$(_RoslynTasksDirectory)Microsoft.VisualBasic.Core.targets</VisualBasicCoreTargetsPath>
<CSharpCoreTargetsPath>$(_RoslynTargetsDirectory)Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
<VisualBasicCoreTargetsPath>$(_RoslynTargetsDirectory)Microsoft.VisualBasic.Core.targets</VisualBasicCoreTargetsPath>
</PropertyGroup>

<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Csc" AssemblyFile="$(RoslynTasksAssembly)" />
Expand Down
Loading