Hello, quite new to Pro Tools /VS code. But I was hoping you might be able to help I'm trying to package a PS script and required module to an exe. The module is MSAL.PS. The script allows the user to authenticate to O365 (using MFA), and then query the Microsoft Graph API. If I use a test module it seems to work fine. Just not this one. The Output indicates something is missing... The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?). [C:\Users\username\AppData\Local\Temp\666ae46575ea4541952bb8b1a7712bfe\Spartan.csproj]. So, I'm stuck, and I dont know how to move forward! Please help! //A
Please, show the command you are using to create the Exe. Did you create a separate PSD1 config file?
Within the PS script I import-module msal.ps
On the properties of the PS project I select create exe and package modules.
Essentially thats all I do… I guess thats wrong!
Are you creating a config file like in here:
Please include here the PS command and .psd1 file you are using to merge the script.
Apologies for my confusion. I’m not using any PS command to merge the module with my script. I’m literally stating ‘import-module msal.ps’ in the body of my ps1 file. On the properties of the project in Visual Studio (not VS code) I have the option to create an exe and merge any modules, ie. modules detected by import-module. When I build the project, the build fails. The output states the following:
Failed to find the developer pack for .NET Version net472. The build is likely going to fail. You can install the Developer Pack from Microsoft: Download .NET SDKs for Visual Studio
Using .NET Framework version: net472
To m knowledge this has been installed.
C:\Users\snipe\AppData\Local\Temp\bdb22ab359624c58bde14d5c9f4a8702\Modules\msal.ps\DeviceCodeHelper.cs(5,17): error CS0234: The type or namespace name ‘Identity’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?) [C:\Users\snipe\AppData\Local\Temp\bdb22ab359624c58bde14d5c9f4a8702\PowerShellProject1.csproj]
This is a new one. It looks like that module includes a CS file that the packager is attempting to compile into the PS executable. I’ll open an issue for this and take a look at that module. It’s like something we will have to tweak to avoid trying to compile CS files included with modules.
Many thanks for looking into it…
This will be fixed in 5.7.22. It will be available in about 30 minutes.
Seems the error has gone and the build looks good. I will need to check on some client machines lacking the module. Will let you know. But thanks for the speedy fix, really appreciate that
Thats great all works!