|
12 | 12 | AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets" |
13 | 13 | DependsOnTargets="_MVVMToolkitGatherAnalyzers"> |
14 | 14 |
|
15 | | - <PropertyGroup> |
16 | | - |
17 | | - <!-- If CSharpCoreTargetsPath is not empty, the Roslyn path is the directory name from there --> |
18 | | - <RoslynDirectoryName Condition="$(CSharpCoreTargetsPath) != ''">$([System.IO.Path]::GetDirectoryName($(CSharpCoreTargetsPath))</RoslynDirectoryName> |
19 | | - |
20 | | - <!-- Otherwise, fallback to $(MSBuildBinPath)\Roslyn\ --> |
21 | | - <RoslynDirectoryName Condition="$(RoslynDirectoryName) == ''">$([System.IO.Path]::Combine(`$(MSBuildBinPath)`,`Roslyn`))</RoslynDirectoryName> |
22 | | - |
23 | | - <!-- Actually check that Microsoft.Build.Tasks.CodeAnalysis.dll exists at the resolved location. |
24 | | - If it doesn't (eg. if the consuming project is a .wapproj project), remove the analyzer. |
25 | | - In that case, the warning will also not be emitted, as there are no C# files to compile anyway. --> |
26 | | - <RoslynAssemblyPath>$([System.IO.Path]::Combine(`$(RoslynDirectoryName)`,`Microsoft.Build.Tasks.CodeAnalysis.dll`))</RoslynAssemblyPath> |
27 | | - <IsRoslynAssemblyPresent Condition="$([System.IO.File]::Exists(`$(RoslynAssemblyPath)`)">true</IsRoslynAssemblyPresent> |
28 | | - <IsRoslynAssemblyPresent Condition="$(IsRoslynAssemblyPresent) == ''">false</IsRoslynAssemblyPresent> |
29 | | - </PropertyGroup> |
30 | | - |
31 | 15 | <Choose> |
32 | | - <When Condition="$(IsRoslynAssemblyPresent) == 'true'"> |
| 16 | + <When Condition="$(CSharpCoreTargetsPath) != ''"> |
33 | 17 |
|
34 | 18 | <!-- Use the CSharpCoreTargetsPath property to find the version of the compiler we are using. This is the same mechanism |
35 | 19 | MSBuild uses to find the compiler. We could check the assembly version for any compiler assembly (since they all have |
36 | 20 | the same version) but Microsoft.Build.Tasks.CodeAnalysis.dll is where MSBuild loads the compiler tasks from so if |
37 | 21 | someone is getting creative with msbuild tasks/targets this is the "most correct" assembly to check. --> |
38 | | - <GetAssemblyIdentity AssemblyFiles="$(RoslynAssemblyPath)"> |
| 22 | + <GetAssemblyIdentity AssemblyFiles="$([System.IO.Path]::Combine(`$([System.IO.Path]::GetDirectoryName($(CSharpCoreTargetsPath)))`,`Microsoft.Build.Tasks.CodeAnalysis.dll`))"> |
39 | 23 | <Output TaskParameter="Assemblies" ItemName="CurrentCompilerAssemblyIdentity"/> |
40 | 24 | </GetAssemblyIdentity> |
41 | 25 |
|
|
0 commit comments