when adding a picturebox and assign a picture to it, in the form designer it shows good (for the first time).
but, after saving the form, in the design it add the lines:
but the File NessTest.resource.psd1 (in this example) is not created, so there is no logo \ Picture when running the script.
but there is an error on the console:
Get-Content : Cannot find path 'E:\Ps1\AD-EXport\NessTest.resources.psd1' because it does not exist.
At E:\Ps1\AD-EXport\NessTest.designer.ps1:10 char:33
+ ... Expression (Get-Content -Path (Join-Path $PSScriptRoot 'NessTest.reso ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (E:\Ps1\AD-EXport\NessTest.resources.psd1:String) [Get-Content], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is null.
At E:\Ps1\AD-EXport\NessTest.designer.ps1:10 char:32
+ ... -Expression (Get-Content -Path (Join-Path $PSScriptRoot 'NessTest.res ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.InvokeExpressionCommand
please help.
what should i do for adding pictures?
how do i create the PSD1 file?
Get-Content : Cannot find path āE:\Ps1\AD\GroupDiff\GroupDifferences.resources.psd1ā because it does not exist.
At E:\Ps1\AD\GroupDiff\GroupDifferences.designer.ps1:13 char:33
It looks like for some reason the resources file isnāt being created in VS Code. It works in Visual Studio so something isnāt hooked up quite right. Stay tuned for a fix.
i tried to work with visual studio and powershell. itās not easy.
The Resources.psd1 was created when adding pictures and icon.
but, when trying to create an imagelist for using at ListView the Resources file went empty and didnāt had nothing in it.
Please help.
Visual Studio Code is better.
I find my self having to load icons and images for their files at run-time vs during design. I assign images from either the resource file or imageList during design but they do not show up at runtime. Is anyone else encountering this issue. I am using Visual Studio Community 2019 with PowerShell Pro Tools for Visual Studio 5.4.3 (according to the downloaded install file) but in Visual Studio Help About it indicates version 1.0.
Hi Adam, iām running into similar issues with trying to create an imageList that is used for a treeView element in a visual studio form. The content of the Form1.resources.ps1 file is empty, but the Form1.resx has the binary data of the imageList, but it doesnāt seem thereās a reference to this resx file ($resrouces points to the Form1.resources.ps1 file). I started looking into this issue when I was trying out my form and received the following errors:
Exception calling āSetKeyNameā with ā2ā argument(s): āIndex was outside the bounds of the array.ā
At C:\Users\adminjlc\Desktop\Form1.designer.ps1:223 char:1
Exception calling āSetKeyNameā with ā2ā argument(s): āIndex was outside the bounds of the array.ā
At C:\Users\adminjlc\Desktop\Form1.designer.ps1:224 char:1
I did some google searching to see if there was any documentation to System.IO.MemoryStream since matzas posted part of his .resources.ps1 file, but iām still figuring out the proper way of ingesting the byte data.
If its related to the empty Form1.resources.ps1 file, is there anything I can manually add into it to get the imageList to function? Any help would be appreciated.
I figured out a workaround for this issue, I converted the images to base64, then converted from bytes to an in memory stream, and finally into a System.Drawing.Image to be added into empty imageList via the $Form1_Load action:
Hey Joshua, thanks for the above code⦠that is letting progress with adding images to a treeview Iām working on. Very keen for this to be resolved for Visual Studio.