Fix build correctness

The project which deploys ILASM tools ends up bringing two runtime
packages that have the same assets:

- runtime.win-x64.microsoft.netcore.runtime.coreclr
- runtime.win-x64.microsoft.netcore.app

Specifically assets like SOS.NetCore.dll exists at different versions in
these packages and end up getting copied twice to the output directory.
This double write ends up breaking our build (as well as basic
isolation).

The short term fix here is to no longer treat this as a code project but
instead a tools project. That eliminates the MS.NetCore.app package and
the associated double writes

Long term though the root issue needs to be addressed: making ilasm and
ildasm easier to deploy.

https://github.com/dotnet/coreclr/issues/15059
上级 eeea542e
......@@ -142,7 +142,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzerDriver", "src
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicAnalyzerDriver", "src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.shproj", "{E8F0BAA5-7327-43D1-9A51-644E81AE55F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IlAsmDeploy", "src\Tools\ILAsm\IlAsmDeploy.csproj", "{46B3E63A-C462-4133-9F27-3B85DA5E7D37}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILAsm", "src\Tools\ILTools\ILTools.proj", "{46B3E63A-C462-4133-9F27-3B85DA5E7D37}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{274B96B7-F815-47E3-9CA4-4024A57A478F}"
EndProject
......
......@@ -356,7 +356,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Edit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnalyzerRunner", "src\Tools\AnalyzerRunner\AnalyzerRunner.csproj", "{60166C60-813C-46C4-911D-2411B4ABBC0F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IlAsmDeploy", "src\Tools\ILAsm\IlAsmDeploy.csproj", "{DA8522ED-02BC-499C-AC71-1DF884F63987}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILTools", "src\Tools\ILTools\ILTools.proj", "{DA8522ED-02BC-499C-AC71-1DF884F63987}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Debugging.Package", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.Package.csproj", "{FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}"
EndProject
......
......@@ -71,6 +71,8 @@
<MicrosoftNetCoreAnalyzersVersion>$(RoslynDiagnosticsNugetPackageVersion)</MicrosoftNetCoreAnalyzersVersion>
<!-- PROTOTYPE(DefaultInterfaceImplementation): The MicrosoftNetCoreILAsmVersion was 2.0.0 -->
<MicrosoftNetCoreILAsmVersion>3.0.0-preview4-27525-72</MicrosoftNetCoreILAsmVersion>
<MicrosoftNetCoreILAsmVersion>3.0.0-preview4-27525-72</MicrosoftNetCoreILAsmVersion>
<MicrosoftNetCoreILDasmVersion>3.0.0-preview4-27525-72</MicrosoftNetCoreILDasmVersion>
<MicrosoftNETCorePlatformsVersion>2.1.2</MicrosoftNETCorePlatformsVersion>
<!-- Using a private build of Microsoft.Net.Test.SDK to work around issue https://github.com/Microsoft/vstest/issues/1764 -->
<MicrosoftNETTestSdkVersion>15.9.0-dev2</MicrosoftNETTestSdkVersion>
......
......@@ -39,7 +39,7 @@ private static string GetIlasmPath()
const string configuration = "Release";
#endif
while (directory != null && !File.Exists(path = Path.Combine(directory, "artifacts", "tools", "ILAsm", configuration, ilasmExeName)))
while (directory != null && !File.Exists(path = Path.Combine(directory, "artifacts", "tools", "ILTools", configuration, ilasmExeName)))
{
directory = Path.GetDirectoryName(directory);
}
......
......@@ -18,7 +18,7 @@
Note SkipGetTargetFrameworkProperties makes it possible to reference project with incompatible TFM.
GlobalPropertiesToRemove makes sure TargetFramework isn't set as a global property for the target project.
-->
<ProjectReference Include="..\..\..\Tools\ILAsm\IlAsmDeploy.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" GlobalPropertiesToRemove="TargetFramework" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<ProjectReference Include="..\..\..\Tools\ILTools\ILTools.proj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" GlobalPropertiesToRemove="TargetFramework" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
</ItemGroup>
<ItemGroup>
......@@ -101,4 +101,4 @@
<PackageReference Include="xunit.extensibility.core" Version="$(xunitextensibilitycoreVersion)" />
<PackageReference Include="ICSharpCode.Decompiler" Version="$(ICSharpCodeDecompilerVersion)" />
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -63,6 +63,10 @@ public bool Check(TextWriter textWriter)
allGood &= CheckPackageReferences(textWriter);
allGood &= CheckDeploymentSettings(textWriter);
}
else if (ProjectType == ProjectFileType.Tool)
{
allGood &= CheckPackageReferences(textWriter);
}
return allGood;
}
......@@ -459,6 +463,7 @@ private bool CheckTargetFrameworks(TextWriter textWriter, RoslynProjectData data
case "net472":
case "netcoreapp1.1":
case "netcoreapp2.1":
case "netcoreapp3.0":
case "$(RoslynPortableTargetFrameworks)":
continue;
}
......
......@@ -53,6 +53,7 @@ internal static ProjectFileType GetProjectFileType(string path)
case ".csproj": return ProjectFileType.CSharp;
case ".vbproj": return ProjectFileType.Basic;
case ".shproj": return ProjectFileType.Shared;
case ".proj": return ProjectFileType.Tool;
default:
return ProjectFileType.Unknown;
}
......
......@@ -11,6 +11,7 @@ internal enum ProjectFileType
CSharp,
Basic,
Shared,
Tool,
Unknown
}
}
......@@ -115,7 +115,7 @@ Guid getExpectedGuid(ProjectData data)
}
var allGood = true;
foreach (var data in dataList)
foreach (var data in dataList.Where(x => x.ProjectEntry.ProjectType != ProjectFileType.Tool))
{
var guid = getExpectedGuid(data.ProjectData);
if (guid != data.ProjectEntry.TypeGuid)
......
using System;
internal static class Program
{
internal static void Main()
{
throw new Exception("This should not be run");
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<!--
When the project is published as a self-contained app do not require the latest runtime patch.
This is ok since the app is only used for testing.
This is not actually a code building project. Disable all the parts of the SDK
which are involed in copying around build assets
-->
<TargetLatestRuntimePatch>false</TargetLatestRuntimePatch>
<SelfContained>true</SelfContained>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<SkipCopyBuildProduct>true</SkipCopyBuildProduct>
<GenerateDependencyFile>false</GenerateDependencyFile>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<EnableSourceLink>false</EnableSourceLink>
<PublishDir>$(ArtifactsDir)tools\ILAsm\$(Configuration)\</PublishDir>
<PublishDir>$(ArtifactsDir)tools\ILTools\$(Configuration)\</PublishDir>
</PropertyGroup>
<Choose>
......@@ -33,9 +34,9 @@
</When>
</Choose>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(MicrosoftNETCoreILAsmVersion)" />
</ItemGroup>
<!-- Required by common targets but have no implementation in this proj -->
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" />
<!-- Workaround for https://github.com/dotnet/sdk/issues/2573 -->
<PropertyGroup>
......@@ -55,4 +56,17 @@
<Output TaskParameter="TouchedFiles" ItemName="FileWrites"/>
</Touch>
</Target>
<!-- Import design time targets for Roslyn Project System. These are only available if Visual Studio is installed. -->
<!-- Required for project to load in Visual Studio. -->
<PropertyGroup>
<ManagedDesignTimeTargetsPath Condition="'$(ManagedDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.Managed.DesignTime.targets</ManagedDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(ManagedDesignTimeTargetsPath)" Condition="'$(ManagedDesignTimeTargetsPath)' != '' and Exists('$(ManagedDesignTimeTargetsPath)')" />
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(MicrosoftNETCoreILAsmVersion)" />
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(MicrosoftNETCoreILDAsmVersion)" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="$(MicrosoftNETCorePlatformsVersion)" />
</ItemGroup>
</Project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册