c# – “The application to execute does not exist” showing a path to a .dll file


I’m making a simple Console App with VB.net to test command line IO (input arguments, output a string), named ClipboardGet.

While testing I saved the project, hit ‘Build Solution,’ and copied ClipboardGet.exe to an external directory that has some files I’d like to test it with. I’ve done this type of thing countless times in the past without issue, but when I tried calling ClipboardGet.exe from Windows CMD, this happens:

The application to execute does not exist: ‘C:\TestFiles\ClipboardGet.dll’.

I tried copying that DLL to the new directory just to see what happens, and now get this:

Failed to run as a self-contained app.

  • The application was run as a self-contained app because ‘C:\TestFiles->dl\ClipboardGet.runtimeconfig.json’ was not found.
  • If this should be a framework-dependent app, add the ‘C:\TestFiles->dl\ClipboardGet.runtimeconfig.json’ file and specify the appropriate framework.

I’ve recently updated my setup to Visual Studio 2022, used .NET 8.0 as the Target Framework for this project. Previously I was still using .NET 4.5. I suspect either of these may have something to do with it.

Questions:

  1. Why is it looking for a DLL in the 1st place? It’s a barebones EXE that should run on its own.
  2. How can I fix this so I can run the EXE by itself in any location as described?

Leave a Reply

Your email address will not be published. Required fields are marked *