Skip to content

Commit

Permalink
Try to manually export the Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
svrooij committed Dec 27, 2024
1 parent fa655f7 commit 89c2a3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preLaunchTask": "dotnet: build-module", // replace with your actual build task name
"script": "pwsh.exe -noexit -command Import-Module .\\bin\\Debug\\net6.0\\TokenMagician.dll", // replace with your actual script path
//"script": "-noexit -command &{ Import-Module .\\bin\\TokenMagician.dll }", // replace with your actual script path
"cwd": "${workspaceFolder}"
"cwd": "${workspaceFolder}\\src\\TokenMagician"
}
]
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"type": "shell",
"label": "dotnet: build-module",
"command": "dotnet build ${workspaceFolder}\\TokenMagician.csproj",
"command": "dotnet build ${workspaceFolder}\\src\\TokenMagician\\TokenMagician.csproj",
"group": {
"kind": "build",
"isDefault": true
Expand Down
3 changes: 3 additions & 0 deletions src/TokenMagician.Loader/ModuleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ModuleLoader : AssemblyLoadContext
private ModuleLoader(string mainModulePathAssemblyPath)
: base (name: "TokenMagician", isCollectible: false)
{
Console.WriteLine($"Loading module from {mainModulePathAssemblyPath}");
_assemblyDir = Path.GetDirectoryName(mainModulePathAssemblyPath) ?? "";
_thisAssembly = typeof(ModuleLoader).Assembly;
_thisAssemblyName = _thisAssembly.GetName();
Expand Down Expand Up @@ -62,6 +63,7 @@ private ModuleLoader(string mainModulePathAssemblyPath)
/// </summary>
public static Assembly Initialize()
{
Console.WriteLine("Initializing ModuleLoader");
ModuleLoader? instance = _instance;
if (instance is not null)
{
Expand All @@ -72,6 +74,7 @@ public static Assembly Initialize()
{
if (_instance is not null)
{
Console.WriteLine("ModuleLoader already initialized");
return _instance._moduleAssembly;
}

Expand Down
16 changes: 6 additions & 10 deletions src/TokenMagician/TokenMagician.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,17 @@
# FunctionsToExport = @()

# Cmdlets to export from this module.
# CmdletsToExport = @(
# "Deploy-WtWin32App",
# "Get-WtWin32Apps",
# "New-IntuneWinPackage",
# "New-WtWingetPackage",
# "Remove-WtWin32App",
# "Unprotect-IntuneWinPackage"
# "Update-WtIntuneApp"
# )
CmdletsToExport = @(
"Get-TmMsiToken"
)

# Variables to export from this module.
# VariablesToExport = @()

# Aliases to export from this module.
# AliasesToExport = @()
AliasesToExport = @(
"Get-MsiToken"
)

# List of all files included in this module.
FileList = @(
Expand Down

0 comments on commit 89c2a3c

Please sign in to comment.