-1

I recently migrated the code on visual studio 2005(x64) to visual studio 2010(x86) (Both on .Net 2.0 framework). I get this error at

winsock declaration : Public Winsock2 As AxMSWinsockLib.AxWinsock

Call Stack Error :

The variable 'Winsock2' is either undeclared or was never assigned

I tried the solutions on the net but couldn't resolve.

1) I changed the Target from 'Any CPU' to 'x86' in the configuration manager.

2) Tried to download .dll files online and add it in project but no change.

Please suggest if I can resolve this error on VS2010 or is it better I find an alternative to winsock on VS2010.

I understand this is an outdated question as the tools used are very old but I have to make changes on an old product of the company I work for.

1 Answers1

0

Several possible causes and solutions:

1.The source code has a reference to a variable, such as Button1, that was never declared or assigned. If it was not assigned, you will get a warning, not an error. To correct this error, please declare or assign the variable specified in the error message.

2.the problem might arise from the constructor of the offending control being declared anything other than public. Please do the following for fix:

  • Solution → Clean Solution;
  • Build → Rebuild Solution;
  • Close Visual Studio, re-open.

3.Your project is x64, but Visual Studio is a 32-bit application and you cannot load a form or control compiled to 64-bit in the designer. You need to change the project to "Any CPU" at design time and then change the project to "Any CPU" at build time.

As for the other possibilities, you can look at the previous question to find the answer.

Julie Xu-MSFT
  • 334
  • 1
  • 5