Program Built on Win7 won't run on WinXP

2019-02-23 03:24发布

I have a project that I'm building on Windows 7 (32-bit) using Visual Studio 2005. The program builds fine, and I can move it to another Windows 7 machine and run it just fine. The problem comes when I try to move it to a Windows XP Pro machine. When I try to run the file, I get the following error:

"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

When I open the event viewer, there are three system errors related to this issue:

  • Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced assembly is not installed on your system.
  • Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The referenced assembly is not installed on your system.
  • Generate Activation Context failed for [path to my exe]. Reference error message: The operation completed successfully.

I've tried installing the Visual C++ 2005 SP1 Redistributable Package, which doesn't help.

If I build the project on an XP computer, I'm able to run it on another XP computer (that doesn't have the C++ redistributable) and a Windows 7 computer.

Always building on the XP isn't a viable option since I'm not the only person who will be building this and everyone else will be using Win7.

5条回答
欢心
2楼-- · 2019-02-23 04:01

Check the missing system DLLs with Dependency Walker if it's a native binary - http://www.dependencywalker.com/

Also check that you have needed WINVER - http://msdn.microsoft.com/en-us/library/aa383745%28v=vs.85%29.aspx otherwise the SDK falls back to SDK version, which is Vista+ for newer versions. Therefore you might accidentally call a few functions that are not even available on XP.

查看更多
叼着烟拽天下
3楼-- · 2019-02-23 04:01

Software built on newer operating systems or library versions will likely have dependencies on new APIs or capabilities that do not exist in older versions of the operating system or libraries.

You can either:

  • build your software on the oldest system you intend to support. This presumes that newer versions of the system have retained backwards compatibility with the base version. Your software will not be able to take advantage of features available in newer versions of the OS, but should be able to run on all backwards compatible systems delivered in the future.

  • build your software once for each system on which you intend to deploy it. This is more work, but means that you can configure your software to take advantages of new APIs and capabilities as they are available on various release iterations of the platform.

查看更多
Melony?
4楼-- · 2019-02-23 04:02

Assemblies are .NET, not native code. You may be missing the .NET framework. The Visual C++ Redistributable will not include a .NET assembly.

查看更多
叛逆
5楼-- · 2019-02-23 04:17

This is what ended up fixing the problem:

Copy the following folder: "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT" (since this is the file mentioned in the event viewer) into the same directory as the .exe I was having trouble executing. This lets the program use the dependency it was built against.

查看更多
手持菜刀,她持情操
6楼-- · 2019-02-23 04:19

We experienced similar problem after have updated our version of Visual Studio to Visual Studio 2005 SP1. It ship with an updated version of MFC and of the CRT.

You can detect the problem using Dependency Walker (http://www.dependencywalker.com/).

If it appear to be that try to make sure the windows update are applied. You can also download and run the Visual Studio 2005 SP1 redistributable.

Visual Studio 2005 redistributable http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14431

Visual Studio 2005 SP1 redistributable http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5638

Vivian De Smedt.

查看更多
登录 后发表回答