Console Application - Unable to find a version of

2019-05-07 17:45发布

Like others, I'm having an issue with a simple console application that reads records from our database.

This small program needs to sit on our file server. It reads new records and forwards a summary off to the parent company.

This is going to be a scheduled task that runs every X minutes.

I do NOT want an Installer, because I don't want the server to require a reboot.

From the screenshot, notice I have almost all versions of the framework already installed and that the debug information is copied into the program folder.

This is the debug version of the program, but no other debug information is being output to the window.

I have tried building at 2.0, 3.5, and 4.0. All versions give me the same error message.

screenshot

[UPDATE]: wal asked in a comment for

<?xml version="1.0"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>

This is a console app, so that is literally the entire app.config file. I am typically clueless when it comes to these .config settings; however, I seem to feel like I have a handle on this one! :)

2条回答
Deceive 欺骗
2楼-- · 2019-05-07 18:31

I suspect the .Net installation is corrupted. You can try the following tool to clean .net framework and re-install.

.net framework cleanup tool

查看更多
够拽才男人
3楼-- · 2019-05-07 18:33

I originally thought someone was going to fuss at me for bad technique when I put my executable here, but I didn't care at the time. I just wanted to get it to work.

Notice where the executable was placed?

screenshot from OP

It is in the C:\Windows\System32 folder.

Obviously, the System32 folder is meant for Windows commands.

So, why did I place my small executable here? Because that folder is almost guaranteed to be included in the Windows Environment Path.

I knew someone was eventually going to get irritated with me, so I thought I'd move it today into a suitably named new folder in the Program Files (x86) directory.

Well, I did that, and now, like magic, the program runs fine.

So, I'm going to guess that .NET Framework applications are not permitted to run in the System32 folder.

I would, however, like to hear people tell me what is exactly up with that and why .NET Framework applications can not get in here.

查看更多
登录 后发表回答