the document item has no code-behind file
Hello,
I created a PowerShell WPF Window for the first time today. Unfortunately, I get the following error message in the properties of the button:
“The document item has no code-behind file. Add a code-behind file and a class definition before adding event handlers.”
(see picture attached)
What do I have to do to use the event handler?
Name Value
---- -----
PSVersion 5.1.17763.503
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.503
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PowerShell Tools for Windows Version 4.7.1
Comments (9)
-
-
can one of you guys please do me a favor and turn on the logging for poshtools?
https://docs.poshtools.com/powershell-tools-documentation/diagnostics
Can you also upload your psproj contents?
I just tried this on a fresh install of 2019 community and it’s not doing this.
-
reporter - attached log.txt
Log
-
reporter - attached PowerShellProject1.zip
new Project
-
reporter Hello Adam,
I had uploded the files on July 1, 2019.
Kind regards
Thomas
-
I have found that if I run VS as admin I don’t run into this issue. Not sure if a permissions or profile issue.
-
reporter Hello Dan,
I must install my computer new.
I have may problems with the poshtools.
I want run the PowerShellProject1.ps1 as Script: [cid:image001.png@01D538B3.CF62AE70]
I get this Error.
[cid:image002.png@01D538AF.1DDA3690]
If I run the Code within the PowerShell Interactive Window, all ok.
[cid:image003.png@01D538B9.9E44EC80]
Note: I must changed the PowerShell Execution Policy for the Interactive Window
[cid:image004.png@01D538BA.0AA7A890]
My Environment now:
Microsoft Visual Studio Enterprise 2017 Version 15.9.14 VisualStudio.15.Release/15.9.14+28307.770 Microsoft .NET Framework Version 4.7.03190
Installed Version: Enterprise
C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
MLGen Package Extension 1.0 MLGen Package Visual Studio Extension Detailed Info
NuGet Package Manager 4.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
PowerShell Pro Tools for Visual Studio 1.0 A set of tools for developing and debugging PowerShell scripts and modules in Visual Studio.
ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info
System Center Visual Studio Authoring Extensions 1.1.0.0 System Center Visual Studio Authoring Extensions
Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
[cid:image005.png@01D538BA.1EC09DF0]
Kind Regards
Thomas
-
reporter Hello Dan,
I fixed the problem. I installed the PowerShellProTools module as described here: https://docs.poshtools.com/powershell-pro-tools-documentation/powershell-module
Kind Regards Thomas [cid:image001.png@01D53B26.27357AF0]https://www.axians.de/de/portfolio/data-center-infrastructure/data-center-workshops/?wmc=180820IO_O1507&utm_source=180820signatur&utm_medium=sonst&utm_campaign=1507_IO_O
-
- changed status to resolved
- Log in to comment
Currently having the same issue.
I have tried VS 2017 (15.9.13) and 2019 community editions.
I can build and run the GUI but unable to add event handlers, I have named all controls and the main window.