Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

VB
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



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)). "
Posted
Updated 24-Oct-13 18:54pm
v4
Comments
OriginalGriff 24-Oct-13 14:12pm    
What do you mean "doesn't run most of my codes" - remember, we can't see your screen, or access your HDD so we are even more in the dark than you are! :laugh:

Use the "Improve question" widget to edit your question and provide better information.
Tenzin Trullkhang 24-Oct-13 23:46pm    
Found out only one form is giving me problem. That form as two dll files. I included that in the reference, double checked in the release folder but still i'm getting the error messages. Updating the question with more details..
Ranjan.D 24-Oct-13 14:14pm    
Oh boy you just need to target the framework version that's it.. what code you have written to break ? I'm kinda lost :laugh:
Tenzin Trullkhang 24-Oct-13 14:41pm    
So, technically if I install the .NET framework 4 on the XP machine. My codes should work like how it runs on win7 ?? If that's the case then I believe the problem is deeper than I thought it is. :(
OriginalGriff 24-Oct-13 14:46pm    
Depends what version of .NET you are using - i.e. what version you are targeting for your build. You only need to ensure that the version installed on XP is at least as high.
There is a simple way to check the current version installed:
http://www.codeproject.com/Tips/188674/A-safe-way-to-get-the-user-to-check-if-the-NET-fra
If you are targeting V3.0, and the machine has 4.0 then you are fine. To be honest, if you don't have the right version then your app shouldn't run at all! :laugh:

What errors is it throwing?

1 solution

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.
 
Share this answer
 
v5
Comments
Tenzin Trullkhang 24-Oct-13 23:21pm    
In My Project / Compile dialog
* Target CPU = x86 already done
* Target Framework = .NET Framework 4 Client Profile already done

In My Project/Application dialog
* Enable XP visual style checkbox is already checked
* There's no target framework in application dialog
* Regarding the commenting of supportedos on the line above it, it says that
If your application is designed to work with Windows 7, uncomment the following supportedOS node. But I uncomment the line, built it and I still get the error:

" 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)). "
Mike Meinz 25-Oct-13 8:34am    
{CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA} is a Windows WBEM component. It is not part of the .NET Framework. It is called by the .NET Framework. I checked on my Windows XP PC and it exists.

Is {CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA} in the Windows XP registry HKEY_CLASSES_ROOT\CLSID hive?
Is the InprocServer32 value = C:\WINDOWS\system32\wbem\wmiutils.dll?

You mention adding DLL references and DLLs into the release folder?
What are those?
If these DLLs are related to Web-Based Enterprise Management (WBEM), they should not be put into your application's folder. You should use them in place in the C:\Windows\System32\wbem folder.

On your Windows XP PC, which service pack of Windows XP is it running? For the most compatibility, you should be running XP Service Pack 3. I created a VB .NET Console application that used your code. I ran it on both Windows 8 and Windows XP SP3 without problem. I added System.Management into My Project / References. The first line of my source code is Imports System.Management
Tenzin Trullkhang 25-Oct-13 14:51pm    
Yeah, I imported the system.management
one of the dll file is to retrieve the machineID and another one to encrypt and decrypt.
on the VM im running win xp sp3.

I'm getting this when building my project :
"F:\New folder\Quiz_pro_ver0.1\Quiz_pro_ver0.1\Activation.vb(55) : warning BC42105: Function 'GetProcessorId' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2580,9): warning MSB3178: Assembly 'Ecnryptor.dll' is incorrectly specified as a file.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2580,9): warning MSB3181: Two or more files have the same target path 'Ecnryptor.dll'.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2580,9): warning MSB3178: Assembly 'MachineId.dll' is incorrectly specified as a file.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2580,9): warning MSB3181: Two or more files have the same target path 'MachineId.dll'.
Quiz_pro_ver0.1 -> F:\New folder\Quiz_pro_ver0.1\Quiz_pro_ver0.1\bin\Debug\Quiz_pro_ver0.1.exe
"
Mike Meinz 25-Oct-13 15:19pm    
I think the problem might be that you added references to the DLLs that the .NET System.Management NameSpace classes call. You should not do that. If so, you should remove all DLL references from the project where .NET is the interface to the DLL.

Look in My Project / Publish / Application Files. Check "Show All Files". Make sure that there are no C:\Windows or C:\Windows subdirectory DLLs listed there. What is listed there? Please be specific.

Look in My Project / References What are the References listed there? Please be specific.

You mention adding DLL references and DLLs into the release folder?
What are those? Please be specific.
Tenzin Trullkhang 25-Oct-13 15:42pm    
the two dll files are : MachineID.dll and Encryptor.dll. I referred some posts to get the machineID and to encrypt the ID to generate a product key.

I checked in MyProject/Publish/ApplicationFiles and the dll files are repeated, project.exe, project.exe.manifest, project.pdb and project.xml are listed.

Can you instruct me how to remove the COM objects? I'm quite new to VB. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900