microsoft / Intune-Resource-Access

Sample code and scripts for interfacing with the Intune Resource Access APIs.
MIT License
54 stars 58 forks source link

Problems building Powershell Module #154

Open StefanHorz opened 1 month ago

StefanHorz commented 1 month ago

Hello, I have problems building a PowerShell-Module for PFXImportFS as described here https://learn.microsoft.com/en-us/mem/intune/protect/certificates-imported-pfx-configure#import-pfx-certificates-to-intune . At menu Build/PFXImportPS I'm getting these errors: Severity Code Description Project File Line Suppression State Error (active) CS0234 The type or namespace name 'Intune' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\AddKSPKey.cs 28 Error (active) CS0234 The type or namespace name 'Intune' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\ExportPrivateKey.cs 27 Error (active) CS0234 The type or namespace name 'Intune' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\ExportPublicKey.cs 27 Error (active) CS0246 The type or namespace name 'ManagedRSAEncryption' could not be found (are you missing a using directive or an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\ExportPublicKey.cs 44 Error (active) CS0234 The type or namespace name 'Intune' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\ImportPrivateKey.cs 27 Error (active) CS0246 The type or namespace name 'Intune' could not be found (are you missing a using directive or an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\NewUserPFXCertificate.cs 35 Error (active) CS0246 The type or namespace name 'Intune' could not be found (are you missing a using directive or an assembly reference?) PFXImportPS C:\Intune-Resource-Access-master\src\PFXImportPowershell\PFXImportPS\Cmdlets\NewUserPFXCertificate.cs 36 Warning The referenced component 'Microsoft.Identity.Client' could not be found. PFXImportPS Warning The primary reference "C:\Intune-Resource-Access-master\src\PFXImportPowershell\EncryptionUtilities\Source\bin\Release\Microsoft.Intune.EncryptionUtilities.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.8" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.7.2". PFXImportPS Warning The referenced project 'EncryptionUtilities' is targeting a higher framework version (4.8) than this project’s current target framework version (4.7.2). This may lead to build failures if types from assemblies outside this project’s target framework are used by any project in the dependency chain. PFXImportPS Warning The referenced project 'EncryptionUtilities' is targeting a higher framework version (4.8) than this project’s current target framework version (4.7.2). This may lead to build failures if types from assemblies outside this project’s target framework are used by any project in the dependency chain. PFXImportPSUnitTests Is any detailed description available how to build 'PFXImport PowerShell Project' cmdlets? What are the Prerequisites?

Best regards, Stefan

StefanHorz commented 1 month ago

Sorry, for that VS-newbie question. One of the initial Warnings while opening the project in VS was "The primary reference "C:\Intune-Resource-Access-master\src\PFXImportPowershell\EncryptionUtilities\Source\bin\Release\Microsoft.Intune.EncryptionUtilities.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.8" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.7.2" So I have to install the targeting NETFramework versions with "Visual Stuidio Installer" in tab "Indivdual components" first.

Best regards, Stefan