diff --git a/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt b/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt index 29b0b6c921..cbcd67c68f 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt +++ b/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt @@ -10,6 +10,18 @@ add_library(pwrshcommon target_include_directories(pwrshcommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +# +# VS 2017 corrupts the INCLUDE environment variable when processing the csproj +# file generated for this template. The netfxsdk path is shortened from +# C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um +# to +# Include\um +# This prevents msbuild from locating corerror.h and throws a resolution error +# during compilation. We work around the problem by force-including the +# contents of the environment variable before it gets corrupted. +# +target_include_directories(pwrshcommon PUBLIC $ENV{INCLUDE}) + if (BUILD_ONECORE) # Libraries to use when creating this binary for Windows on OneCore-based SKUs set(PWRSHCOMMON_WINDOWS_LIBS diff --git a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp index 198d9e7482..481e439e40 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp +++ b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp @@ -703,6 +703,7 @@ namespace NativeMsh "System.Collections.Immutable", "System.Collections.NonGeneric", "System.Collections.Specialized", + "System.Configuration", "System.ComponentModel", "System.ComponentModel.Annotations", "System.ComponentModel.Composition", @@ -803,6 +804,7 @@ namespace NativeMsh "System.Runtime.Serialization.Json", "System.Runtime.Serialization.Primitives", "System.Runtime.Serialization.Xml", + "System.Security", "System.Security.AccessControl", "System.Security.Claims", "System.Security.Cryptography.Algorithms", @@ -813,6 +815,7 @@ namespace NativeMsh "System.Security.Cryptography.Pkcs", "System.Security.Cryptography.Primitives", "System.Security.Cryptography.X509Certificates", + "System.Security.Permissions", "System.Security.Principal", "System.Security.Principal.Windows", "System.Security.SecureString", @@ -822,6 +825,7 @@ namespace NativeMsh "System.ServiceModel.Primitives", "System.ServiceModel.Security", "System.ServiceModel.Web", + "System.ServiceProcess", "System.ServiceProcess.ServiceController", "System.Text.Encoding", "System.Text.Encoding.CodePages", diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index c5b0de24fc..c0fe6a9ca4 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -37,7 +37,7 @@ - +