Open BBoldenow opened 2 years ago
I'm not able to verify my log in at work so I made an alt account. I forgot to point out that the VSCode terminal window reports "The operation completed successfully." for the reg import. Opening up the registry, or querying it, makes it pretty clear that that is not the case. I get the same print out when it actually is successful in VS2022.
are you seeing an error associated with running that task - in the console or otherwise? any task errors in the output channel for tasks?
@meganrogge - There is nothing to indicate there's an error with the task - in fact the build makes it to the Post-Build step, and displays the default "The operation completed successfully." text. The reg command also returns "0" which is supposed to indicate success.
I see no logs in the "Tasks" output channel - errors or otherwise.
Is this a new issue or have you seen it in the past too?
Is this a new issue or have you seen it in the past too?
This is a new way of registering our COM interop DLL, so unfortunately I can't say. Previously we relied on RegAsm and/or the .csproj setting "Register for COM interop". Unfortunately both of those methods require admin privileges, and we needed something that would work without that requirement. That led me down this path of creating a .reg file, and replacing the ROOT keys, then importing it. This method works great with VS2022, but most of our developers use VSCode.
@meganrogge - I'd like to follow up on this, is there any additional information I could provide?
@BBoldenow I notice you use Get-Command reg
in the script. Does it work if you pass Get-Command
into the task "command"
too?
@BBoldenow I notice you use
Get-Command reg
in the script. Does it work if you passGet-Command
into the task"command"
too?
@meganrogge I'm not sure I'm doing this as you expected, but I made two tasks to test what you're asking. One that does:
{ "label": "Import Registry Entries", "type": "shell", "command": "reg import fullfilepath", "group": "build", "dependsOn": [ "firstTask" ] }
And another that does:
{ "label": "firstTask", "type": "shell", "command": "Get-Command reg" }
This still doesn't work, but it's definitely "getting" the reg command (you can see it print out in the console).
I was in a hurry and completely mistyped my "firstTask"...sorry about that!
Just saw this part
From VSCode, this fails to import the keys from the file created above, I can import it manually just fine
From VS2022, the entire script works fine
reg import $regToLoad
seems like probably a permissions issue
could you log/ print after the line in your script where the file gets created to check if that file gets produced/exists?
Just saw this part
From VSCode, this fails to import the keys from the file created above, I can import it manually just fine
From VS2022, the entire script works fine
reg import $regToLoad
seems like probably a permissions issue
could you log/ print after the line in your script where the file gets created to check if that file gets produced/exists?
@meganrogge - Yes, I put comments in the powershell script, but probably should have called it out more explicitly:
The file gets created, and the keys get modified to be HKEY_CURRENT_USER keys instead of HKEY_CLASSES_ROOT keys - this all works fine. The key import even appears to "work" as the reg import command prints out "The operation completed successfully." However in VSCode these keys fail to make it into the registry despite the successful print. I also thought it was a permissions issue, and have tried running VSCode as admin, but this doesn't seem to have any effect.
@meganrogge - Do you need any additional information? I'm pretty stumped as to how to get this working in VS Code.
@meganrogge - For what it's worth I did get this working as a task instead of a PostBuild event. I still think the PostBuild event should be resolved, but it let's me work around the issue in the meantime:
{ "label": "Register COM Interop (Options Prompted)", "type": "process", "command": "PowerShell.exe", "args": [ "${workspaceFolder}/Source/COM_UI/RegisterCOMInterop.ps1 -targetPath ${workspaceFolder}/.output/${input:debugOrRelease}/ -targetName COM_UI" ], "group": "build" }
Steps to Reproduce:
The RegisterDll script: