Wireless Communication Library Support Forum

Common => FAQ => Topic started by: xaydin on April 02, 2009, 05:56:31 PM

Title: Error Message in Visual Studio 2008
Post by: xaydin on April 02, 2009, 05:56:31 PM
Hello, I recently downloaded the WCL personal 6.5 and installed it on my laptop. I am using Visual Studio 2008 professional on Vista Home. When I tried to test the provided demos in VB.NET and C# I received an error from VS.

An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'wcl, Version=6.5.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

After reading some of the previous posts it may be because I am running Vista.  What are your recommendations to get the framework running?

I have not tried WCL lite nor have I tried it on XP (it would be SP2). Any information given will be most appreciated.

Thank you.

-----------
Xaydin
"If there is a better solution...find it"  - Thomas Edison
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on April 05, 2009, 08:53:16 AM
Install WCL in different location. By default it is installed in C:\program files\WCL but Vista does not allow to access this folder from applications (VS). Install the library to other place.
Title: Could not load file or assembly 'wcl...
Post by: Nature on September 14, 2009, 01:10:49 PM
Hi, I am having a similar problem :

The wcl.dll has been added as a reference to a c#.net code library which is in tern used in a c#.net Windows Forms application, this was built using Visual Studio 2005 and packaged into an MSI. Once the MSI is run on the target machine the wcl.dll appears in the correct Progam Files sub folder alongside the DotNet dll and exe files.

The target machine is running Windows XP Service Pack 2 with DotNet Framework 2.0 installed, are there any other prerequisites for using the wcl.dll?

The full error message is detailed below, this happens when I called the wcl.wclBluetoothRadio.SetName() method but I guess it would happen with any method call to the wcl.dll :

------------------------------------------

type=System.Runtime.InteropServices.COMException
Message : Could not load file or assembly 'wcl, Version=6.6.2.0, Culture=neutral, PublicKeyToken=ecf108583bd9ca73' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

------------------------------------------
Thanks
Title: Re: Error Message in Visual Studio 2008 0x800736B1
Post by: Mike Petrichenko on September 14, 2009, 01:13:29 PM
Hi,

you have to redistribute vcredist_x86.exe together with your app and install it on target PC. You can find this file in the WCL installation folder.
Title: Re: Error Message in Visual Studio 2008
Post by: Nature on September 14, 2009, 01:37:21 PM
Hi,

I have copied vcredist_x86.exe to the target machine and run it but I am still having the same problem. Also is there a silent install version fo the vcredist_x86.exe available? This is so that we can do deployments over a distributed network without needing a user present to click the dialogs.

Many thanks
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on September 14, 2009, 01:41:23 PM
Please, take a look on this article: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/cfa882e6-ce6d-4e99-bb3f-36a0b13ba0ca

Yes, redist supports silent install (as it does in WCL installation package).
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on September 14, 2009, 01:57:57 PM
Hi,

I have uploaded the latest vcredist file. You can download it here (http://www.btframework.com/wcl/vcredist_x86.exe) and try. I this it should solve the problem.
Title: Re: Error Message in Visual Studio 2008 0x800736B1
Post by: Nature on September 14, 2009, 02:11:51 PM
Excellent that fixed it, thanks again
Title: Re: Error Message in Visual Studio 2008
Post by: royce on January 13, 2010, 10:25:06 PM
I'm also seeing an error message like the original post in this thread. 

System.BadImageFormatException was unhandled
  Message="Could not load file or assembly 'wcl, Version=6.7.1.0, Culture=neutral, PublicKeyToken=ecf108583bd9ca73' or one of its dependencies. An attempt was made to load a program with an incorrect format."
  Source="WCLtest4"
  FileName="wcl, Version=6.7.1.0, Culture=neutral, PublicKeyToken=ecf108583bd9ca73"
  FusionLog="=== Pre-bind state information ===\r\nLOG: User = E6400-Win7\\Royce\r\nLOG: DisplayName = wcl, Version=6.7.1.0, Culture=neutral, PublicKeyToken=ecf108583bd9ca73\n (Fully-specified)\r\nLOG: Appbase = file:///C:/d/vc# 2008/WCLtest4/WCLtest4/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : WCLtest4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: wcl, Version=6.7.1.0, Culture=neutral, PublicKeyToken=ecf108583bd9ca73\r\nLOG: Attempting download of new URL file:///C:/d/vc# 2008/WCLtest4/WCLtest4/bin/Debug/wcl.DLL.\r\nERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.\r\n"
  StackTrace:
       at WCLtest4.Form1.InitializeComponent()
       at WCLtest4.Form1..ctor() in C:\d\vc# 2008\WCLtest4\WCLtest4\Form1.cs:line 15
       at WCLtest4.Program.Main() in C:\d\vc# 2008\WCLtest4\WCLtest4\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Development is on a Win7 64 bit laptop.  I was seeing this message with the WCL installed in \Program Files (X86)\WCL, so I uninstalled WCL and reinstalled in a new directory (not under \Program Files).
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 13, 2010, 10:46:29 PM
Hi,

It is always good to check the demo apps before.

Add reference to <WCL_INSTALL_DIR>\redist\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest to your assembly references list.
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 13, 2010, 10:47:38 PM
Also, do not foget to add WCL.DLL into references list as well
Title: Re: Error Message in Visual Studio 2008
Post by: royce on January 13, 2010, 11:21:03 PM
WCL.DLL is in the references list along with the Microsoft.VC80.CRT.manifest.  Still seeing this error.  Any other suggestions?
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 13, 2010, 11:25:29 PM
Demo built success?

Also, your project is 64 bit, WCL is 32 bit (I guess).
Title: Re: Error Message in Visual Studio 2008
Post by: royce on January 13, 2010, 11:29:30 PM
DOH!!  Changed my project to 32 bit.  Works now.  Thanks, Mike!!
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 13, 2010, 11:30:03 PM
You are very welcome.
Title: Re: Error Message in Visual Studio 2008
Post by: carlos on February 02, 2010, 06:40:26 PM
Hi Mike

I cant download latest vcredist file from: http://www.btframework.com/wcl/vcredist_x86.exe, as you say in this post.
Where can i dowload it from?

Thanks
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on February 02, 2010, 06:42:12 PM
Hi,

The latest WCL versions do not need this file. However, you can download latest redist file from MS site.
Title: Re: Error Message in Visual Studio 2008
Post by: martidem on January 06, 2011, 06:19:58 PM
I am getting the same error as posted above ("Could not load file or assembly...").  I've tried all the solutions listed above.  What I've discovered is that any PC/laptop that has Visual Studio installed runs the application just fine, but PCs without VS get the error.  I went so far as to uninstall VS from a laptop to test the theory, and sure enough, once VS wasn't installed, the error occurred.

I am publishing as a 32-bit application, and I am including vcredist_x86 in my installation.  However, when I include VC80.CRT.manifest as suggested, Visual Studio gives me a warning that the reference is not used, and I get an error at installation time ("Application validation did not succeed.  Unable to continue.") even on the machines with VS where it previously installed and ran fine without the manifest reference.

Any ideas on other runtime libraries that may need to be included on client machines that don't have development tools installed?
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 06, 2011, 06:32:03 PM
Hi,

Please take a look on this How To topic How to redistribute WCL with your application (http://www.btframework.com/howto.htm#redist).
Also open demo application (any) and check which files are referenced (you can find which files must be referenced in How To above as well).
Please use only DLLs from WCL/Redist folder. Do not use DLLs from your VS redistributable. As well as do not use any vcredist installers as WCL requres only DLLs from WCL package and will not work with any other version of those DLLs.
Title: Re: Error Message in Visual Studio 2008
Post by: martidem on January 06, 2011, 10:45:05 PM
First, I'm a little confused.  You're response here says not to use vcredist installers, but your previous responses in this thread suggest using vcredist_x86 as a potential solution.  My install of the WCL librarys didn't include a vcredist installer, so I downloaded it from Microsoft.

Second, if I follow the how-to and the sample applications, I'm supposed to reference Microsoft.VC80.CRT.manifest.  Whenever I include that reference, the installation gets an error and the application doesn't install, so I never get to the dependency error since I can not actually run the app (even on my development machine).  But without the manifest, the app installs and runs but only on machines with VS installed (even an old XP machine that I literally dug out of the closet to test my theory).  I'm repeating myself, I know, but to me it suggests that there's some other runtime library that's required -- a library included in VS.  I ran DependencyWalker against wcl.dll on the old machine (after removing VS) and there were quite a few dll dependencies now missing.  I copied those from my development machine but with no change -- still getting the dependency error.  Perhaps whatever the dependency is is included in the manifest but since I can't get the install to work with the manifest...

I am developing the app on a 64-bit Windows 7 machine with .NET 4.0, but am publishing it as a 32-bit .NET 2.0 app (since my customer requires that it work on old XP machines).  Is it possible that this is why I'm having issues with the manifest file?  Should I use the 4.0 manifest even though I'm publishing for 2.0?
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 06, 2011, 10:49:12 PM
As you can see the previouse responses were a year ago. And the last from them was "The latest WCL versions do not need this file. However, you can download latest redist file from MS site." It is already year since WCL does not need vcredist.

I afraid I can not help you with your installer as I don't know what you use. However I can guess that you didn't redistribute all the files but just a manifest. As described you must redistribute few DLLs (the list is available on How To page I gave link to early).

No, if you referenced WCL for .NET 2.0 from the latest package. If you use erly WCL version than it is 2.0 any way. I think th eproblem that you didn't distribute all the required files as it is described on How To page.
Title: Re: Error Message in Visual Studio 2008
Post by: martidem on January 06, 2011, 11:23:58 PM
You are right.  (He says as he wipes the egg off his face.)  Visual Studio doesn't want to include some of the dll's in the install package because they aren't referenced in the code.  And it won't let me add them as references to be included in the install.  Possibly because I'm trying to do a quick-and-dirty publish (as opposed to having a "setup" project to manage the installation) so I can get a sample app to the customer ASAP.

If I find a solution to getting the libraries included, I'll post here again as an FYI should anyone else have the same issue.
Title: Re: Error Message in Visual Studio 2008
Post by: Mike Petrichenko on January 06, 2011, 11:36:17 PM
Use InnoSetup. I have never seen something simple and better and free.