Skip to content

Commit

Permalink
Merge pull request #590 from dotnet/fix589
Browse files Browse the repository at this point in the history
Include BCL assemblies required for VS 2017 build tools
  • Loading branch information
AArnott committed Apr 15, 2021
2 parents 8126d95 + 9e74f1e commit 96b6548
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Expand Up @@ -58,10 +58,10 @@ stages:
displayName: Configure git commit author for testing
- task: UseDotNet@2
displayName: Install .NET Core SDK 5.0.100
displayName: Install .NET Core SDK 5.0.202
inputs:
packageType: sdk
version: 5.0.100
version: 5.0.202

- task: UseDotNet@2
displayName: Install .NET Core 3.1
Expand Down Expand Up @@ -306,10 +306,10 @@ stages:
packageType: sdk
version: 3.1.100
- task: UseDotNet@2
displayName: Install .NET Core SDK 5.0.100
displayName: Install .NET Core SDK 5.0.202
inputs:
packageType: sdk
version: 5.0.100
version: 5.0.202
- script: dotnet --info
displayName: Show dotnet SDK info
- bash: |
Expand Down
2 changes: 1 addition & 1 deletion global.json
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "5.0.100"
"version": "5.0.202"
}
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Expand Up @@ -4,7 +4,7 @@
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)..\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<OutputPath>$(MSBuildThisFileDirectory)..\bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
<DocumentationRootFolder>$(MSBuildThisFileDirectory)..\wiki\api</DocumentationRootFolder>
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)strongname.snk</AssemblyOriginatorKeyFile>
Expand Down
48 changes: 48 additions & 0 deletions src/Nerdbank.GitVersioning.Tasks/AssemblyLoader.cs
@@ -0,0 +1,48 @@
#if NETFRAMEWORK

using System;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class ModuleInitializerAttribute : Attribute { }
}

namespace Nerdbank.GitVersioning.Tasks
{
internal static class AssemblyLoader
{
[ModuleInitializer]
internal static void LoaderInitializer()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}

private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
try
{
var required = new AssemblyName(args.Name);
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), required.Name + ".dll");
if (File.Exists(path))
{
AssemblyName actual = AssemblyName.GetAssemblyName(path);
if (actual.Version >= required.Version)
{
return Assembly.LoadFile(path);
}
}
}
catch
{
}

return null;
}
}
}

#endif
Expand Up @@ -23,10 +23,13 @@ IMPORTANT: The 3.x release may produce a different version height than prior maj
<file src="$BaseOutputPath$net461\NerdBank.GitVersioning.dll" target="build\MSBuildFull\NerdBank.GitVersioning.dll" />
<file src="$BaseOutputPath$net461\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$net461\Newtonsoft.Json.dll" target="build\MSBuildFull\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$net461\PInvoke.Kernel32.dll" target="build\MSBuildFull\PInvoke.Kernel32.dll" />
<file src="$BaseOutputPath$net461\System.Buffers.dll" target="build\MSBuildFull\System.Buffers.dll" />
<file src="$BaseOutputPath$net461\System.Memory.dll" target="build\MSBuildFull\System.Memory.dll" />
<file src="$BaseOutputPath$net461\System.Numerics.Vectors.dll" target="build\MSBuildFull\System.Numerics.Vectors.dll" />
<file src="$BaseOutputPath$net461\System.Runtime.CompilerServices.Unsafe.dll" target="build\MSBuildFull\System.Runtime.CompilerServices.Unsafe.dll" />
<file src="$BaseOutputPath$net461\System.Text.Json.dll" target="build\MSBuildFull\System.Text.Json.dll" />
<file src="$BaseOutputPath$net461\Validation.dll" target="build\MSBuildFull\Validation.dll" />
<file src="$BaseOutputPath$net461\System.Runtime.CompilerServices.Unsafe.dll" target="build\MSBuildFull\System.Runtime.CompilerServices.Unsafe.dll" />
<file src="$BaseOutputPath$net461\PInvoke.Kernel32.dll" target="build\MSBuildFull\PInvoke.Kernel32.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\**" target="build\runtimes\" />

<!-- Additional copies to work around DllNotFoundException on Mono (https://github.com/dotnet/Nerdbank.GitVersioning/issues/222) -->
Expand Down

0 comments on commit 96b6548

Please sign in to comment.