Matt Price
Matt Price

Reputation: 45345

Trouble loading a C# app on another machine with .Net 2.0 service pack 2

I'm not really a C#/.Net developer, but I've been asked to solve an issue we are having. We have a small command line app in C# that has been working and recently ran into trouble. On my machine I can build and run it, but when I try to run it on some of our servers it fails. I looks like it fails on the ones that have .Net 2.0 with service pack 2 installed. I don't have this service pack.

Here's the error that we see:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.File name: 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

As far as I can see the system references are set to Specific Version: False.

Upvotes: 0

Views: 826

Answers (4)

sgmoore
sgmoore

Reputation: 16067

Firstly, do you have a config for your application (ie a file named yourappname.exe.config where yourappname obviously is your application name) and is there anything there forcing it to use a particular framework version.

Otherwise you could create one, (something like)

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

You can have as many supportRunTime lines as required, so you can add your version as well as the end-users version to the app config.

Upvotes: 0

jay_t55
jay_t55

Reputation: 11652

Do you have access to the target system? The reason being is that this can be caused by an incorrect installation. As far as I can remember, in Add/Remove in WindowsXP & Vista, you can choose to 'repair' the .NET Framework instead of completely uninstalling it.

Upvotes: 1

Ray
Ray

Reputation: 1585

Make sure System aliases set to Global, Copy Local is False and Specific Version is set to False too.

Upvotes: 2

Filmund
Filmund

Reputation: 71

Have you packaged the application into a setup? Using a Setup project will usually ensure you have all the required dependencies installed.

Upvotes: 2

Related Questions