diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index fc1fb2da4c..cea0a87317 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -1059,8 +1059,9 @@ namespace Microsoft.PowerShell.Commands private static PortableExecutableReference ObjectImplementationAssemblyReference = MetadataReference.CreateFromFile(typeof(object).GetTypeInfo().Assembly.Location); + // This assembly should be System.Runtime.dll private static PortableExecutableReference ObjectDeclaredAssemblyReference = - MetadataReference.CreateFromFile(System.IO.Path.Combine(FrameworkFolder, "System.Runtime.dll")); + MetadataReference.CreateFromFile(ClrFacade.GetAssemblies(typeof(object).FullName).First().Location); private static MetadataReference[] defaultAssemblies = new MetadataReference[] { diff --git a/test/powershell/Add-Type.Tests.ps1 b/test/powershell/Add-Type.Tests.ps1 index f0a4e7f972..142e7e0f5e 100644 --- a/test/powershell/Add-Type.Tests.ps1 +++ b/test/powershell/Add-Type.Tests.ps1 @@ -1,5 +1,5 @@ Describe "Add-Type" { - It "Should not throw given a simple class definition" -Skip { + It "Should not throw given a simple class definition" { { Add-Type -TypeDefinition "public static class foo { }" } | Should Not Throw } }