When trying to use a DataGridView control, I get the following error:
Cannot resolve dependency to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
DataGridView
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: DataGridView
I have a form that I have been working on. It's working fine. But when I add a DataGridView to the form and run the script I get that error. As soon as I remove the DataGridView from the from, the script runs fine.
Re: DataGridView
Please answer the following:
1. What version of PowerShell do you have installed?
2. What platform settings are you using when you run the script?
3. Do you have .NET 2.0 installed?
1. What version of PowerShell do you have installed?
2. What platform settings are you using when you run the script?
3. Do you have .NET 2.0 installed?
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: DataGridView
The server is Windows 2012 R2 running Powershell:
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 1358
These are the platform controls are:
Local Machine
v5 - 64bit
STA mode enabled
.Net Versions Installed:
2.0.50727.4927
3.0.30729.4926
3.5.30729.4926
4.6.01055
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 1358
These are the platform controls are:
Local Machine
v5 - 64bit
STA mode enabled
.Net Versions Installed:
2.0.50727.4927
3.0.30729.4926
3.5.30729.4926
4.6.01055
Re: DataGridView
Sometimes a PSF file can become corrupted and odd things will happen. Have you tried starting a new form and adding just the DGV to the form then run it. If this fails then the issue is not likely with the PSF file. If it succeeds then suspect the PSF.
You clearly have V2 support installed as you can run the form without the DGV.
When creating the new form do not use the same template that you used for the failing form. It, too, can be corrupted.
You clearly have V2 support installed as you can run the form without the DGV.
When creating the new form do not use the same template that you used for the failing form. It, too, can be corrupted.
Re: DataGridView
Without the DGV you can easily check the running Net version by adding this to the form load. It will appear in the output pane when the form opens.
Write-Host ([System.Windows.Forms.DataGridView].Assembly.ImageRuntimeVersion)
Write-Host ([System.Windows.Forms.DataGridView].Assembly.ImageRuntimeVersion)
Re: DataGridView
I figured it out. The assembly for .net 2.0 (System) was not loaded. Not sure why it doesn't use the 4.0 assembly. But it's resolved.