1

I wrote a simple c# program that I would like to run using a Powershell file. I am brand new to PowerShell with no experience with it except for the couple hours I've spent trying to figure out how this is done. The program is a simple console program that should pop up when executed. Thank you for your help

1

1 Answer 1

1

You can write code in an assembly and then register it with powershell you can do this by using the Add-Type cmdlet as far back as powershell 2.0, the previous version of powershell did this differently.

So say your code in c# is in foo.dll you would use:

Add-Type -Path foo.dll

you can then call methods with syntax like this from your objects.

[MyClass]::MyMethod(10)

there is a good article on how to do this here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.