I've created a VSTO outlook plugin and it works fine when using ClickOnce deployment and installing via Setup.exe generated by ClickOnce. Now, i've used Wix to create an MSI for the same. I'm adding vsto in registry using batch file:
#echo off
setlocal enabledelayedexpansion
%SystemRoot%\system32\reg.exe ADD "HKCU\Software\Microsoft\Office\Outlook\Addins\MyPlugin" /v "FriendlyName" /t REG_SZ /d "MyPlugin"
%SystemRoot%\system32\reg.exe ADD "HKCU\Software\Microsoft\Office\Outlook\Addins\MyPlugin" /v "Manifest" /t REG_SZ /d "file:///C:/Program Files (x86)/MyPlugin/MyPlugin.vsto"
%SystemRoot%\system32\reg.exe ADD "HKCU\Software\Microsoft\Office\Outlook\Addins\MyPlugin" /v "Description" /t REG_SZ /d "MyPlugin"
%SystemRoot%\system32\reg.exe ADD "HKCU\Software\Microsoft\Office\Outlook\Addins\MyPlugin" /v "LoadBehavior" /t REG_DWORD /d 3
endlocal
This registry Key is added as expected when I run the msi.
But when i load the Outlook plugin, it's in Inactive state. The LoadBehavior value turns from 3 to 2. In outlook application, LoadBehavior is Not Loaded. A runtime error ocurred during the loading of the COM Add-in.
The text/issue that is logged in VSTO Log:
Log entry added at 10:20:28 AM:
-----------Caption----------------
Microsoft Office Application Add-In
-----------Message----------------
An add-in could not be found or could not be loaded.
-----------Details----------------
Could not load file or assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73e9e1c2746dd019' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73e9e1c2746dd019' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: 'MyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73e9e1c2746dd019'
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.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName)
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)
When I view the EventViewer, there's a VSTO4.0 error
This event is not displayed correctly because the underlying XML is not well formed. Below is the raw text of the event.
4096200x80000000000000265553<User machine name>Customization URI: file:///C:/Program Files (x86)/Common Files/Microsoft Shared/VSTA/Pipeline.v10.0/PipelineSegments.store Exception: Exception reading manifest from
file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/VSTA/Pipeline.v10.0/PipelineSegments.store: the manifest may not be valid or the file could not be opened.
************** Exception Text ************** System.Deployment.Application.InvalidDeploymentException: Exception reading manifest from
file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/VSTA/Pipeline.v10.0/PipelineSegments.store: the manifest may not be valid or the file could not be opened. --->
System.Xml.XmlException: '', hexadecimal value 0x01, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e) at
System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar) at
System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at
System.Xml.XmlTextReaderImpl.ParseDocumentContent() at
System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read() at
System.Xml.XsdValidatingReader.Read() at
System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType
manifestType, Uri sourceUri) --- End of inner exception stack trace --- at
Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(
TimeSpan timeout) at
Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn() ************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.9151 (WinRelRS6.050727-9100) CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll ---------------------------------------- Microsoft.VisualStudio.Tools.Office.Runtime.v10.0 Assembly Version: 10.0.0.0 Win32
Version: 10.0.60828.0 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime.v10.0/10.0.0.0__b
03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.v10.0.dll ----------------------------
------------ System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.9147 (WinRelRS6.050727-
9100) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll -
--------------------------------------- System.Core Assembly Version: 3.5.0.0 Win32 Version:
3.5.30729.9135 built by: WinRelRS6 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll -------
--------------------------------- Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0 Assembly
Version: 10.0.0.0 Win32 Version: 10.0.60828.0 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0/10.0.
0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0.dll ----------------
------------------------ System.AddIn Assembly Version: 3.5.0.0 Win32 Version: 3.5.30729.9135
built by: WinRelRS6 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.AddIn/3.5.0.0__b77a5c561934e089/System.AddIn.dll -----
----------------------------------- Microsoft.Office.Tools.Outlook.v9.0 Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.7079 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Outlook.v9.0/9.0.0.0__b03f5f7f11d50a3a
/Microsoft.Office.Tools.Outlook.v9.0.dll ----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime.v10.0 Assembly Version: 10.0.0.0 Win32 Version:
10.0.60828.0 CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime.v10.0/10.0.
0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.v10.0.dll ----------------
------------------------ System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version:
2.0.50727.9136 (WinRelRS6.050727-9100) CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows
.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32
Version: 2.0.50727.9136 (WinRelRS6.050727-9100) CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll -
--------------------------------------- System.Deployment Assembly Version: 2.0.0.0 Win32 Version:
2.0.50727.9136 (WinRelRS6.050727-9100) CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Deployment/2.0.0.0__b03f5f7f11d50a3a/System.Deployment
I tried to remove to all items from Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Resiliency\DisabledItems, but still my outlook plugin is not loading.
I spent a lot of time in try different workarounds but none worked. Please help me how to resolve this problem and load the vsto plugin successfully?
I downgraded .NET Framework version from 4.7.2 to 4.6.1 and updated Target Platform & Build Platform from Any CPU to ```x86`` in VS2019. Upon doing this change, I was able to load the Add-in in Outlook.
I know this is kinda old but here is another solution in case this problem keeps happening.
If you create form regions in your Outlook vsto, you need to declare them in the registry here :
Ordinateur\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\FormRegions\IPM.Note
My addin is called "AddinK" so I need to create the regedit key
Ordinateur\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\FormRegions\IPM.Note
in which I add my two form regions called "myname" and "itsname" by creating 2 REG_SZ values called
AddinK.myname
and
AddinK.itsname
with the value
=AddinK
Related
Server Error in '/' Application. Could not load file or assembly
'Microsoft.Web.Infrastructure' or one of its dependencies. The located
assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040) 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.Web.Infrastructure' or one of its dependencies.
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
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.Web.Infrastructure' could not be
loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'Microsoft.Web.Infrastructure' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
[FileLoadException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +232
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +113
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +23
System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +49
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +762
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +259
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +167
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +238
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +78
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +334
System.Web.Compilation.BuildManager.ExecutePreAppStart() +178
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +746
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +552
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +732
I need help on solving this problem. I've been trying to solve this problem for several days.
I have recently downloaded the MVC5 ABP template, the project compiles but I get 109 warnings. When executing the project, I get a YSOD.
ABP v3.0.0
.Net Framework 4.6.1
Visual Studio 2017
IIS 7
I get the following error message on YSOD:
Cannot load a reference assembly for execution.
[BadImageFormatException: Cannot load a reference assembly for execution.]
[BadImageFormatException: Could not load file or assembly 'netfx.force.conflicts' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
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 'netfx.force.conflicts' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +726
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +196
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +45
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +172
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +111
System.Web.Compilation.BuildManager.ExecutePreAppStart() +156
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): Could not load file or assembly 'netfx.force.conflicts' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +772
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +196
I get a around 60 warnings for missing references such as:
The referenced component 'System.Xml.XmlDocument' could not be found.
I get a few warnings like this:
Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
And also this guy:
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: etc.
Going with VS's suggestions for resolving the conflicts...did not make any difference other than to remove the warning.
[BadImageFormatException: Cannot load a reference assembly for execution.]
Delete the bin folder in the Web project and rebuild the solution.
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
ABP v3.0.0 is based on .NET Standard 2.0.
This concerns you regardless if you are on MVC 5.x, .NET Framework 4.x or .NET Core 2.x.
You should use VS2017 15.3.3+.
I have a CodedUI Test project in Visual Studio 2013. After following instructions for integrating SpecFlow with the CodedUI API, I'm getting the following error in the FeatureSetup (Assembly binding logging was turned on)
Test Name: TheWelcomeScreen
Test FullName: (...)Feature.TheWelcomeScreen
Test Source: c:\path\to\My.feature : line 6
Test Outcome: Failed
Test Duration: 0:00:00
Result Message:
Class Initialization method (...)Feature.FeatureSetup threw exception. System.IO.FileNotFoundException: System.IO.FileNotFoundException: Could not load file or assembly 'SpecFlow.Assist.Dynamic, Version=1.0.2.0, Culture=neutral' or one of its dependencies. The system cannot find the file specified.
=== Pre-bind state information ===
LOG: DisplayName = SpecFlow.Assist.Dynamic, Version=1.0.2.0, Culture=neutral
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: SpecFlow.Assist.Dynamic, Version=1.0.2.0, Culture=neutral | 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:/Path/To/Current/TestResults/Directory/Out
LOG: Initial PrivatePath = NULLCalling assembly : TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Path\To\Current\TestResults\Directory\Out\BWE.Tests.DLL.config
LOG: Using host configuration file:
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:/Path/To/Current/TestResults/Directory/Out/SpecFlow.Assist.Dynamic.DLL.
LOG: Attempting download of new URL file:///C:/Path/To/Current/TestResults/Directory/Out/SpecFlow.Assist.Dynamic/SpecFlow.Assist.Dynamic.DLL.
LOG: Attempting download of new URL file:///C:/Path/To/Current/TestResults/Directory/Out/SpecFlow.Assist.Dynamic.EXE.
LOG: Attempting download of new URL file:///C:/Path/To/Current/TestResults/Directory/Out/SpecFlow.Assist.Dynamic/SpecFlow.Assist.Dynamic.EXE.
Result 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.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.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at TechTalk.SpecFlow.Infrastructure.BindingAssemblyLoader.Load(String assemblyName)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at TechTalk.SpecFlow.Infrastructure.TestRunnerFactory.Create(Assembly testAssembly)
at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Boolean async)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner()
at (...)Feature.FeatureSetup(TestContext testContext) in c:\path\to\My.feature.cs:line 0
My packages.config file for this solution:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.3.0" targetFramework="net40" />
<package id="CompareNETObjects" version="3.01.0.0" targetFramework="net40" />
<package id="ImpromptuInterface" version="6.2.2" targetFramework="net40" />
<package id="SpecFlow" version="1.9.0" targetFramework="net40" />
<package id="SpecFlow.Assist.Dynamic" version="1.0.2" targetFramework="net40" />
</packages>
In the "Properties" for the SpecFlow.Assist.Dynamic DLL, the CopyLocal setting is set to true. After building the solution, the bin\Debug folder has SpecFlow.Assist.Dynamic.dll in it, but the folder for the current test run in the TestResults folder does not contain this DLL. It does contain these DLLs:
The DLL for my project
AutoMapper.dll
KellermanSoftware.Compare-Net-Objects.dll
TechTalk.SpecFlow.dll
I've opened and closed Visual Studio, uninstalled and reinstalled the NuGet package, deleted the package sources locally, cleaned, rebuilt, rebooted, manually removed the bin\Debug folder and rebuilt... The list goes on. I'm still getting the same exception.
I don't know if it by design or not but MSTest does not deploy assemblies to the test folder unless at least one type from that assembly is used in the tests or code under test. So if you are instantiating types from and assembly by reflection then you'll run into issues.
This issue has been noted by others.
The simple solution is to do one of two things:
Use a dummy type from the assembly in question in your tests. Just do a redendant var dummy = new TheType()
Use a deployment item to copy the dll. This is less good I think as you might not get it deployed unless you are running a test which has the deployment item on it, which could mean you need to use the attribute several times, although I'm not 100% sure about that.
I've included ServerAppFabric.Client.1.0.2912 in an application to do some basic cache diagnostics. When I try to use the cache API though, I get this exception:
Caught unhandled exception: System.TypeInitializationException: The type initializer for 'Microsoft.ApplicationServer.Caching.ConfigManager' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ApplicationServer.Caching.Core.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\src\Frank\Mischief\bin\Microsoft.ApplicationServer.Caching.Core.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=31bf3856ad364e35.dll' or one of its dependencies. The system cannot find the file specified.
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.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Habanero.Commands.AppFabric.CacheDirCommand.<>c__DisplayClass9.<GetResolverForPath>b__8(Object o, ResolveEventArgs args) in C:\src\Habanero\Habanero\Commands\AppFabric\CacheDirCommand.cs:line 84
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
Any thoughts on how to help it find the resource DLL? Its not in the nuget package...
The nuget package I'm using (http://nuget.org/packages/ServerAppFabric.Client/1.0.2912) comes with the following DLLs:
Microsoft.ApplicationServer.Caching.Client.dll
Microsoft.ApplicationServer.Caching.Core.dll
Microsoft.WindowsFabric.Common.dll
Microsoft.WindowsFabric.Data.Common.dll
I have a similar problem with this NuGet. The package installs four dlls but only references the top-two of them :
MSBuild copy the two other references in the bin folder, maybe by detecting types from them are used in the two upper, but some other deployment tools can not.
Keep sure you have all the four references into your bin folder.
IT recently moved me from a win xp 32-bit machine onto a Win 7 Enterprise 64-bit machine. After installing VS2010, MVC3 and various other components, I pulled the most current version of an MVC3 project I am working on. When I run the debugger, I get the Yellow Screen of Death, which references a dll from another project in my solution with the following error code:
Could not load file or assembly 'Core' or one of its dependencies. Access is denied.
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.
And the Stack Trace:
[FileLoadException: Could not load file or assembly 'Core' or one of its dependencies. Access is denied.]
[FileLoadException: Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): Could not load file or assembly 'Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8972240
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
It ran fine on the other machine, and will load on the server fine. Is there any security issues or anything I am overlooking, I am new to the win7 64 bit environment? Or is there something else I forgot to account for that is obvious to one of you?
EDIT: I have also tried IIS Express 7.5 with the same end result.
EDIT2: I resolved the issue for now by disabling impersonation in the web.config file while debugging locally, and adding the line to the release transform for deployment on the server.
Are you running the app pool under a dedicated account? That is, something other than Network Service? If so you need to add permissions to the asp.net temporary files directory.