Ulka
Ulka

Reputation: 71

How to run csproj on .net runtime

Let's say I have csproj and if I run msbuild from command line on it, it's generates a target TaskCli.dll

msbuild TaskCli.csproj
TaskCli -> bin\Debug\TaskCli.dll

Which tool I should use to run the TaskCli.dll? I am using .net framework 4.5.

Edit: I changed the output type as console app and msbuild generating a .exe file. Then I can run the .exe file from command line. Thanks for all your helps.

TaskCli -> bin\Debug\TaskCli.exe

Upvotes: 0

Views: 3295

Answers (1)

Dynamic Link Libraries (DLL's), created with the .net Framework, are not directly executable.

An Option for testing these, without executable would be PowerShell:

Add-Type -Path "..\TaskCli.dll"
$yourClass = new-object YourNamespace.YourClass
$yourClass.yourMethod("myParameter")

Another Commandline Option is using RUNDLL32, which allow you to invoke a function exported from a DLL:

RUNDLL32.EXE <dllname>, <entrypoint> <optional arguments>

Upvotes: 1

Related Questions