Autocad .net framework 32 bits selection - vb.net

Gents,
I was wondering if there is any way to configure the autocad.exe.config file so it works with the 32 bits version of .net framework.
I'm developing an application for autocad 2008 32 bits in a 64 bits machine (windows 7) that gets some data from an access database (32 bits) therefore I'm getting the infamous "'microsoft.ace.oledb.12.0' provider is not registered on the local machine" error.
Looking for a solution I've found that the only way to solve this is to target x86 machine in VS, but Autocad can't load the application because is reading the .net configuration from framework64 folder.
Update:
This is the error I get in the autocad command line when the x86 application is loaded:
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly
'file:///C:\#Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1
\bin\Debug\ClassLibrary1.dll' or one of its dependencies. An attempt was made
to load a program with an incorrect format.
File name:
'file:///C:\#Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1
\bin\Debug\ClassLibrary1.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
at loadmgd()
=== Pre-bind state information ===
LOG: User = GLOBAL\rodrigo.cortes
LOG: Where-ref bind. Location =
C:\#Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1\bin\Debu
g\ClassLibrary1.dll
LOG: Appbase = file:///C:/Program Files/AutoCAD 2008/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will
only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\AutoCAD
2008\acad.exe.Config
LOG: Using machine configuration file from
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL
file:///C:/#Documentos/Personales/CODING/AutoCad/vb.net/OleDBTest/ClassLibrary1/
bin/Debug/ClassLibrary1.dll.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

Related

Unable to start program C:\...\****.dll VB.net application Visual Studio 2015

I have been working on a VB.net web application for some time now, and I accidentally switched the "Application Type" setting from a Class Library to a Windows Form Application. I tried to build, this failed, but when I switched back, the program would no longer execute, displaying the error:
Unable to start program 'C:\Users\User\...\bin\Project.dll'
'C:\Users\User\...\bin\Project.dll' is not a valid Win32 application.
Prior to this the application would build fine.
Furthermore, in the properties page for the project, the "Web" section displays the error:
An error occurred trying to load the page.
Value does not fall within the expected range.
The build output offers no clues as to the unexpected behavior, it builds fine, it just won't run. The code is also fully functional.
I have tried restarting multiple times, deleting the /bin directory and allowing it to rebuild from scratch (then restoring the old contents when this failed), setting the startup project, changing the target CPU and debug/release mode. I have tried both ReSharper build, and Visual Studio build.
I also tried making a build configuration that targeted 'C:\Users\User...\bin\Project.vshost.exe', but this would execute then close immediately.
I have no option to set a "Startup Object" in the application page of the project settings, but this has never been an issue. I have never needed to target an EXE to run my application before. If I try other application types, it states "Sub Main was not found in project".
I cannot recreate the project due to it's size so would love it if anyone could offer some insight, next time I will be mindful not to play around with the IDE settings.
======= UPDATED =======
So I fixed the "not running issue" by changing the WebProjectProperties to:
<UseIIS>True</UseIIS>
<UseCustomServer>False</UseCustomServer>
<servers defaultServer="">
But now when I run the program, the following error is displayed:
Could not load file or assembly
'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException: Could not load file or assembly
'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack trace and details:
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.VisualStudio.QualityTools.UnitTestFramework (2) | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/User/Source/Repos/Findem/IfitConsulting/
LOG: Initial PrivatePath = C:\Users\User\Source\Repos\Findem\IfitConsulting\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\User\Source\Repos\Findem\IfitConsulting\web.config
LOG: Using host configuration file: C:\Users\User\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0ef61219/b7128029/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0ef61219/b7128029/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
LOG: Attempting download of new URL file:///C:/Users/User/Source/Repos/Findem/IfitConsulting/bin/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack trace
[FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947380
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
Ok so finally figured out how to fix it, hopefully this can help some other poor soul who ends up in the same situation!
The first step is to edit your project.vbproj file and change:
<WebProjectProperties>
<UseIIS>False</UseIIS>
<UseCustomServer>True</UseCustomServer>
<servers defaultServer="SelfHostServer">
...
</servers>
</WebProjectProperties>
To
<WebProjectProperties>
<UseIIS>True</UseIIS>
<UseCustomServer>False</UseCustomServer>
<servers defaultServer="">
...
</servers>
</WebProjectProperties>
Then, you want to go to your /bin directory and delete the following files (Project is your projects name):
Project.dll
Project.dll.CodeAnalysisLog.xml
Project.dll.config
Project.dll.CodeAnalysisLog
Project.pdb
Project.xml
And re-build and it all works fine!

Assembly.LoadFrom doesn't load dll from bin\debug when running unit tests with resharper

I am using VS 2015 Update 2 with Resharper Ultimate 2016.1 and I have this weird issue.
I have a test project called Test which references two projects, Model and Persistence. The model project contains nhibernate entity classes and the Persistence project contains *.hbm.xml files. They were generated with llblgenpro 4.2. I am using nhibernate 4.0.4.
I initialize NHibernate with this call:
NHibernateSession.Init(
new SimpleSessionStorage(),
new string[] { "Persistence.dll", "Model.dll" });
When I run one of my test cases the nhibernate initialization fails with this exception:
System.IO.FileNotFoundException was unhandled by user code
FileName=file:///C:\Users\costa\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\Persistence.dll
FusionLog==== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Users\costa\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\Persistence.dll
LOG: Appbase = file:///C:/projects/csharp/Test/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Users\costa\AppData\Local\Temp\s0hjyhsk.jq1\a3514fde-acb9-4c62-a0ce-a586f8202f35.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Users/costa/AppData/Local/JetBrains/Installations/ReSharperPlatformVs14/Persistence.dll.
HResult=-2147024894
Message=Could not load file or assembly 'file:///C:\Users\costa\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\Persistence.dll' or one of its dependencies. The system cannot find the file specified.
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at SharpArch.NHibernate.NHibernateSession.<>c__DisplayClass36_0.<CreateSessionFactoryFor>b__0(MappingConfiguration m) in C:\work\sharp-arch\Solutions\SharpArch.NHibernate\NHibernateSession.cs:line 412
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
InnerException:
If I copy the persistence.dll to the C:\Users\costa\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14 folder, the test case works fine. persistence.dll is in the C:/projects/csharp/Test/bin/Debug folder because the persistence project is referenced in the test project.
This all worked fine in VS 2013 with nhibernate 3.3.1. Also I got all the dll versions to align using the assemblybinding elements in the test project app.config file.
My projects target .Net 4.6 and I use nunit 3.2.1.
I found this:
Resharper runs UnitTest from different location
However, in my case 'Shadow-copy assemblies being tested' is turned off, Use separate AppDomain for each assembly with tests is also turned off. Run Tests from is set to Project output folder.
Any ideas what could cause this?
Thanks
An update: If I do this it works:
string path = Assembly.GetExecutingAssembly().Location;
string directory = Path.GetDirectoryName(path);
NHibernateSession.Init(
new SimpleSessionStorage(),
new string[] { directory + "\\Persistence.dll", directory + "\\Model.dll" });
Update 2. My project uses the Sharp Architecture library. NHibernateSession is a class that belongs to this library.
This is likely a change in NUnit 3, which no longer changes the current directory to the location of the assembly under test. I believe this is because it can run multiple assemblies in a single test run - so which directory would be best?
As per the NUnit 3 Breaking Changes document, you can use TestContext.CurrentContext.TestDirectory to locate the directory that contains the assembly under test.

MVC 4 Web Api Build in x64 mode giving error while executing "Could not load file or assembly 'xxx' or one of its dependencies

My MVC4 Web Api application is working fine when it is build in Any Cpu mode.In this mode it is creating 32 bit dll. However when I build the application in x64 mode then while executing it is giving following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CoreService' could not be loaded.
=== Pre-bind state information ===
LOG: User = xxx
LOG: DisplayName = CoreService
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: CoreService | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/StartFromScratch/src/CoreService/
LOG: Initial PrivatePath = D:\StartFromScratch\src\CoreService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\StartFromScratch\src\CoreService\web.config
LOG: Using host configuration file: C:\Users\310138409\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/a4e7fe2c/87c2ced5/CoreService.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/a4e7fe2c/87c2ced5/CoreService/CoreService.DLL.
LOG: Attempting download of new URL file:///D:/StartFromScratch/src/CoreService/bin/CoreService.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055
I am not getting any concrete solution for the same. Moreover we cannot continue in 32 bit mode as It is making call to 64 bit unmanaged code. Thanks in advance.
Actually problem is because of IISExpress. It is 32bit of IISExpress is running whenever we are executing from VS2012 IDE so it is giving incorrect format error. So once I installed the IISexpress 8.0 and done the registry entry to make sure that IISExpress 64 bit get executed from VS2012; my problem got resolved.
You should properly configure your solution configurations for x64 build. Right click on your solution in VS, select Configuration Manager select x64 under Active solution platforms drop down list and check whether all of your projects has built with x64 platform.

What would cause a 'could not load file or assembly' error concerning 'Microsoft.WindowsAzure.Configuration'?

I have a multi-tier Azure application I've been working on. It uses web and worker roles behind an MVC front end, as well as Azure SQL and Table storage. It has been working well for a while, both in the emulator and the cloud.
I've just started adding some Service Bus functionality to it, adding the Service Bus package from NuGet, and now I find that although everything still compiles, I am getting the following runtime error:
Server Error in '/' Application.
Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.WindowsAzure.Configuration' could not be loaded.
=== Pre-bind state information ===
LOG: User = JCFXLAPTOP\User
LOG: DisplayName = Microsoft.WindowsAzure.Configuration
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.WindowsAzure.Configuration | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/Work/CLIENTS/PageEngine/Solutions/PageEngine/Web.PageEngine/
LOG: Initial PrivatePath = D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/4904ccbc/14659c77/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/4904ccbc/14659c77/Microsoft.WindowsAzure.Configuration/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///D:/Work/CLIENTS/PageEngine/Solutions/PageEngine/Web.PageEngine/bin/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Using application configuration file: D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12731430
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12847312
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12675965
I noticed that the ServiceBus NuGet package references a newer version of the Microsoft.WindowsAzure.Configuration dll (1.7.0.2), and wondered if that might be the cause. I've tried overriding this and changing all references to either 1.7.0.0 or 1.7.0.2 - neither change helped. I've also tried removing all Azure references from the solution and re-adding references by installing NuGet packages and referencing the latest SDK. This hasn't helped either.
I should add that at all times the Microsoft.WindowsAzure.Configuration dll has been in the bin folder of the MVC application, and that it has always had CopyLocal set to true.
I note that the Azure Configuration NuGet package was updated very recently (Friday 27th July), and I wonder if that might have something to do with it.
Does anybody know what the issue could be?
EDIT
Just to confirm that removing the service bus nuget package fixes the problem. Reinstating it causes the problem to recur. I don't know if this matters but the Microsoft.WindowsAzure.Configuration dll added as part of the NuGet package seems to have an inconsistent version number. While the path suggests the version should be 1.7.0.2:
D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\packages\Microsoft.WindowsAzure.ConfigurationManager.1.7.0.2\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll
... the version number in the properties inspector is still 1.7.0.0
This was an issue with the Microsoft.WindowsAzure.Configuration assembly, version 1.7.0.2
Temporarily fixed by rolling back to either 1.7.0.1 or 1.7.0.0 and then permanently fixed in 1.7.0.3
Had same problem. I reverted Microsoft.WindowsAzure.ConfigurationManager back to NuGet version 1.7.0.1. Now it is working OK.

I can't compile a standard "WCF Service Library" in x86 format

If I start up Microsoft Visual Studio, create a standard "WCF Service Library", and compile it, it works perfectly.
However, if I go into Properties..Build and set the "Platform Target" to "x86", it won't compile. I need "x86" because I need to reference some .dll's that simply won't work if I choose "All Platforms".
-----start error-----
System.BadImageFormatException: Could not load file or assembly 'file:///D:\backtest\C#\WCF service\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'file:///D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.Tools.SvcHost.ServiceHostHelper.LoadServiceAssembly(String svcAssemblyPath)
=== Pre-bind state information ===
LOG: User = dr-satellite\Shane
LOG: Where-ref bind. Location = D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll
LOG: Appbase = file:///D:/backtest/C#/WCF service for/WcfServiceLibrary/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: D:\backtest\C#\WCF service for\WcfServiceLibrary\bin\Debug\WcfServiceLibrary.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///D:/backtest/C#/WCF service for/WcfServiceLibrary/bin/Debug/WcfServiceLibrary.dll.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
-----end error-----
Your problem is actually the WCF Test Client complaining that your WCF Service Library is 32bit. This is because by default, the WCF Test Client always runs in 64 bit mode.
Rather than going to the lengths of changing to a WCF Service Application so you can debug, I found the following steps on this blog which makes the WCF Test Client run in 32bit mode - and therefore you will not see the error you have posted.
Copy WcfSvcHost.exe and WcfTestClient.exe from C:\program files (x86)\Microsoft Visual Studio 10.0\Common7\IDE to a local directory. Keep a backup copy of this file, of course.
Start a Visual Studio 2010 Command Prompt (one of the links from the start menu -> Visaul Studio 2010)
"cd" to the directory where your copy of WcfSvcHost is located.
Execute the command "corflags /32BIT+ /FORCE WcfSvcHost.exe"
Execute the command "corflags /32BIT+ /FORCE WcfTestClient"
Copy the files back to where you found it.
Now your WcfSvcHost and WcfTestClient will be running in 32 bit mode, and you can debug away!
I found two good methods to solve this:
Installing the 64-bit version of Matlab means you can compile 64-bit .dll's which are compatible with the 64-bit WCF Service Library. This removes the need to compile in 32-bit mode so it doesn't throw exceptions when it calls the 32-bit assembly. This solution works well.
There are two types of projects you can generate in MSVS 2010: "WCF Service Library" and "WCF Service Application". Although you cannot build and run a "WCF Service Library" in 32-bit mode (it only supports 64-bit), you can build and run a "WCF Service Application" in 32-bit mode.