VB.NET项目在Windows 7上运行得很好。但是当我在Windows XP中运行它时它不会以它应该的方式运行吗? [英] VB.NET project works perfectly on windows 7. But when I run it in windows XP it doesn't run the way it should?

查看:107
本文介绍了VB.NET项目在Windows 7上运行得很好。但是当我在Windows XP中运行它时它不会以它应该的方式运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio中有哪些功能可能会在Windows XP上运行项目时导致问题。



我正在编写项目。差不多完成,在Windows 7上运行得非常好。对于Windows Xp,它只是不运行我的大部分代码。我有点迷茫,我不知道造成这个问题的原因。


我使用的是Visual Studio 2010.



没关系,现在这部分代码即使在安装.net 4之后也会在xp上抛出错误。



What are the features in Visual Studio that might cause issues when running a project on Windows Xp.

I am writing a project. Well almost done, works perfectly fine on Windows 7. With Windows Xp, it just doesn't run most of my codes. I'm kinda lost, I don't know what is causing the issue.

I am using Visual Studio 2010.

okay, right now this part of the code is throwing errors on xp even after installing .net 4.

Public Shared Function GetProcessorId() As String
        Dim strProcessorId As String = ""
        Dim query As New SelectQuery("Win32_processor")
        Dim search As New ManagementObjectSearcher(query)
        Dim info As ManagementObject
        For Each info In search.Get()
            strProcessorId = info("processorId").ToString()
        Next
        Return strProcessorId
    End Function







有了新的发展。

我发现只有一种形式为我创造了问题。

该表单包含两个dll文件。将它们添加到引用(它已经添加)后,我检查了发行文件夹中是否存在dll文件,它们是,我仍然得到相同的错误。我知道我在这里错了。如果你们可以帮助我,我会非常感激。

加载表单时出现错误信息:

检索带有CLSID的组件的COM类工厂{CF4CC405-E2C5 -4DDD-B3CE-5E7582D8C9FA}由于以下错误而失败:80040154类未注册(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))。




There has been a new development.
I found out that only one form is creating the problem for me.
That form includes two dll files. After adding them to the reference ( it was already added ), i checked if the dll files are present in the release folder, they are, I still got the same error. I know I'm wrong somewhere here. Would appreciate a lot if you guys can help me out.
The Error Message on loading the form:
" Retrieving the COM class factory for component with CLSID {CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA} failed due to following error: 80040154 class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). "

推荐答案

<大>第一部分 - 编译选项

我没有Visual Studio 2010.这些说明适用于Visual Studio 2012.抱歉,我不知道是否有相同的选项设置在Visual Studio 2010中。

在我的项目/编译对话框中

选择目标CPU = X86



在我的项目/应用程序对话框中

选择目标框架= .NET Framework 4客户端配置文件

选中启用XP视觉样式复选框

在View Windows中设置,取消注释所有< supportedos> ...< / supportedos>



第二部分 - 引用调用另一个DLL的DLL

在调用DLL的项目中第二个DLL,引用第二个DLL的属性表必须复制本地设置为错误



通过在DLL项目和EXE项目中都有复制本地 = True ,可以使第二个DLL在EXE项目中包含两次。将复制本地设置为 False 设置为第一个DLL项目中第二个DLL的引用将解决该问题。
Part I - Compile options
I don't have Visual Studio 2010. These instructions are for Visual Studio 2012. Sorry, I do not know if the same options settings are in Visual Studio 2010.
In My Project / Compile dialog
Select Target CPU = X86

In My Project / Application dialog
Select Target framework = .NET Framework 4 Client Profile
Check the Enable XP visual styles checkbox
In View Windows Settings, uncomment all of the <supportedos>...</supportedos> lines

Part II - References to a DLL that calls another DLL
In the project for the DLL that is calling the second DLL, the property sheet for the reference to the second DLL must have Copy Local set to False.

By having Copy Local = True in both the DLL project and the EXE project, you cause the second DLL to be included twice in the EXE project. Setting Copy Local set to False for the reference to the second DLL in the first DLL's project will fix that issue.


这篇关于VB.NET项目在Windows 7上运行得很好。但是当我在Windows XP中运行它时它不会以它应该的方式运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆