Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuild repo doesn't build without 3.5 SP1 Targeting Pack #5620

Closed
KirillOsenkov opened this issue Aug 7, 2020 · 1 comment · Fixed by #5621
Closed

MSBuild repo doesn't build without 3.5 SP1 Targeting Pack #5620

KirillOsenkov opened this issue Aug 7, 2020 · 1 comment · Fixed by #5621
Labels
Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. bug needs-triage Have yet to determine what bucket this goes in. Task: Resolve Assembly References (RAR)

Comments

@KirillOsenkov
Copy link
Member

On a clean Windows machine with VS 2019 16.6 where 3.5 SP1 targeting pack was never installed, this very MSBuild repo fails to build with:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\
Bin\Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3645: .NET Framew
ork v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Versio
n=v3.5", .NET Framework v3.5 Service Pack 1 or later must be installed. [C:\MSB
uild\src\MSBuildTaskHost\MSBuildTaskHost.csproj]

When trying to add https://www.nuget.org/packages/Microsoft.NETFramework.ReferenceAssemblies/1.0.0 I've found out that it omits net35 from the list of frameworks it supports. See dotnet/installer#2022 for details.

Fortunately, our friend @jnm2 went out of his way to fill this gap and created this awesome package: https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35

However I found that it still doesn't work because of this check that checks for the "sentinel" System.Data.Entity.dll being installed in the GAC:

#if FEATURE_GAC
// This is a very specific "hack" to ensure that when we're targeting certain .NET Framework versions that
// WPF gets to rely on .NET FX 3.5 SP1 being installed on the build machine.
// This only needs to occur when we are targeting a .NET FX prior to v4.0
if (!BypassFrameworkInstallChecks && moniker.Identifier.Equals(".NETFramework", StringComparison.OrdinalIgnoreCase) &&
moniker.Version.Major < 4)
{
// We have not got a value for whether or not the 35 sentinel assembly has been found
if (!s_net35SP1SentinelAssemblyFound.HasValue)
{
// get an assemblyname from the string representation of the sentinel assembly name
var sentinelAssemblyName = new AssemblyNameExtension(NET35SP1SentinelAssemblyName);
string path = GlobalAssemblyCache.GetLocation(sentinelAssemblyName, SystemProcessorArchitecture.MSIL, runtimeVersion => "v2.0.50727", new Version("2.0.57027"), false, new FileExists(p => FileUtilities.FileExistsNoThrow(p)), GlobalAssemblyCache.pathFromFusionName, GlobalAssemblyCache.gacEnumerator, false);
s_net35SP1SentinelAssemblyFound = !String.IsNullOrEmpty(path);
}
// We did not find the SP1 sentinel assembly in the GAC. Therefore we must assume that SP1 isn't installed
if (!s_net35SP1SentinelAssemblyFound.Value)
{
Log.LogErrorWithCodeFromResources("GetReferenceAssemblyPaths.NETFX35SP1NotIntstalled", TargetFrameworkMoniker);
}
}
#endif

@KirillOsenkov KirillOsenkov added bug needs-triage Have yet to determine what bucket this goes in. Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. Task: Resolve Assembly References (RAR) labels Aug 7, 2020
@KirillOsenkov
Copy link
Member Author

Aha, I see they left us an escape hatch! Setting BypassFrameworkInstallChecks lets us bypass that entire block!

KirillOsenkov added a commit to KirillOsenkov/msbuild that referenced this issue Aug 7, 2020
Fixes dotnet#5620.

Unfortunately the Microsoft.NETFramework.ReferencesAssemblies does not include net35, so we're using https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35 combined with a workaround to bypass looking for System.Data.Entity.dll 3.5.0.0 in the GAC.
Forgind pushed a commit that referenced this issue Aug 10, 2020
)

Fixes #5620.

Unfortunately the Microsoft.NETFramework.ReferencesAssemblies does not include net35, so we're using https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35 combined with a workaround to bypass looking for System.Data.Entity.dll 3.5.0.0 in the GAC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. bug needs-triage Have yet to determine what bucket this goes in. Task: Resolve Assembly References (RAR)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant