Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 大小差异:Powershell ISE与批处理启动器_Wpf_Windows_Powershell_Xaml - Fatal编程技术网

Wpf 大小差异:Powershell ISE与批处理启动器

Wpf 大小差异:Powershell ISE与批处理启动器,wpf,windows,powershell,xaml,Wpf,Windows,Powershell,Xaml,我有一个使用XML节点读取器在Powershell中创建的XAML GUI。当我在ISE中运行脚本时,我所有的控件都在我想要的地方。然后我创建了一个批处理文件来启动它: Powershell.exe -STA -File "C:\Scripts\Study App\Core.ps1" 运行批处理文件后,我注意到GUI本身比在ISE中时更大,因此,我的一些按钮没有对齐。当我右键单击ps1文件并单击RunwithPowerShell时,我也注意到了这种行为ISE的哪些方面导致了较小的窗口大小?我有

我有一个使用XML节点读取器在Powershell中创建的XAML GUI。当我在ISE中运行脚本时,我所有的控件都在我想要的地方。然后我创建了一个批处理文件来启动它:

Powershell.exe -STA -File "C:\Scripts\Study App\Core.ps1"
运行批处理文件后,我注意到GUI本身比在ISE中时更大,因此,我的一些按钮没有对齐。当我右键单击ps1文件并单击RunwithPowerShell时,我也注意到了这种行为ISE的哪些方面导致了较小的窗口大小?我有什么办法来解决这个问题吗?


有一个几乎相同的问题,但有一个显著的区别:我的表单是System.Windows.Window类型,没有System.Windows.Forms.form所需的属性。

PowerShell ISE加载使用直PowerShell时未加载的其他库。我进行了快速搜索,在另一个网站上发现了此问题:

[


似乎解决方案可能使用了SizeToContent=“WidthAndHeight”。

但没有修复。它仍然关闭了5到10个像素。从我看到的情况来看,可能是加载了ISE的程序集而Powershell没有加载。
[appdomain]::currentdomain.GetAssemblys()| sort-property fullname | format table fullname
将显示正在ISE或Powershell中加载的程序集。我做了一个快速检查,仅一个普通的Powershell窗口加载了25个程序集,而ISE加载了47个程序集…您在脚本中调用了哪些程序集?System.Windows.Forms System.Windows.Forms.DataVisualiza但它应该是无关的,因为这些程序集都是通过批处理文件加载到ISE中的。问题是ISE加载的程序集比只运行poweshell脚本要多。ISE加载47个程序集。只运行普通powershell会话只加载25个。因此,我如果ISE中的某些内容与在Powershell中右键单击并运行ps1文件不同,则需要找到缺少的程序集并将其添加到脚本中。