Visual Studio 2010 Express C#, NUnit 2.5.8, White 0.2.0
I am trying to write some tests with the NUnit + White framework.
I can get the White demo (ListBoxExample) up and running without problems.
But when I write a simple test for my own application (.Net 4.0), I have 2 problems:
Application.Launch(""):
This statement does not complain, but does NOT launch my application at all. The path is correct because if I put an incorrect path, I get an error. With the right path there are no errors, but no application is starting.
application.GetWindow(...)
This statement causes an error:
DocBackupTestSuite.Tests.StartupTest: System.IO.FileLoadException : Could
not load file or assembly 'Bricks,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its
dependencies. The located assembly's
manifest definition does not match the
assembly reference. (Exception from
HRESULT: 0x80131040)
But the Bricks.dll file IS referenced in my project...
Thank you for your help
Davy
First problem is solved.
The code did not wait long enough to leave time for the application to start.
Added a Thread.Sleep(10000) after the Application.Launch() statement, and now it starts up.
2nd problem is still pending...
Anyone?
2nd problem also solved:
A reference to Bricks.RuntimeFramework was missing.
After adding this, my test runs fine ;)
If you face this problem below when you use the UI automation library(White-project)
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Bricks,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f' or one of its dependencies.
The system cannot find the file specified.
File name: 'Bricks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f'
please take the following solution:
Add Reference of the dll list as follow:
•Bricks
•Bricks.RuntimeFramework
•Castle.Core
•Castle.DynamicProxy2
•log4net
•nunit.framework
•White.NUnit
•Xstream.Core
Hope your code can be work successfully now.
Download theses stuff here
http://white-project.googlecode.com/svn/tags/0.20/lib/
Reference fromhttp://sunshinetoast.com/Default.aspx
Related
Tying to build a freshly cloned project, when i build i get this error
Could not load file or assembly 'Microsoft.Configuration.ConfigurationBuilders.Azure, Version=1.0.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)
Things I've tried
Removing the reference and adding back in
changing build properties from debug to release
disabling strong name verification via command line using the command "sn -Vr
Microsoft.Configuration.ConfigurationBuilders.Azure.dll"
i've tried updating the reference to latest / previous versions
Everything I try and nothing seems to work, any other ideas?
In app.config or Web.config, delete the following:
, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
download this nuget package and this will work for you.
.NET Framework:
For me the issue was that I had to change the Version=1.0.0.0 in my web.config to match what was loaded and referenced in the web application references. Right click [Microsoft.Configuration.ConfigurationBuilders.Azure] and go to properties and you'll see the version at the bottom. For me it was Version=2.0.0.0.
I've had a look at similar postings but haven't found one that has helped fix this issue.
Just briefly, I have an mvc3 project running on azure. A couple of days ago it lost it's reference to System.Web.MVC for some reason. So I added the reference and changed the Copy Local property to True.
It built and ran on the local emulator ok. I then published it and got the following message when visting the website.
"Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0"
It turns out I only version 3.0.0.1 and not 3.0.0.0 which is stated in my web.congig file. I've tried changing the value in web.config in both the assembly and runtime sections to 3.0.0.1 but this throws another exception in azure.(although didn't change the Public Token)
I've also tried Add Deployable Dependency but this has made no difference and I've tried downloading and adding vers 3.0.0.0 to the project but vs didn't like this dll when publishing.
I've also tried changing the property Specifc Version for the assembly to False but this hasn't worked.
So for some reason I don't have v3.0.0.0 anymore but don't know how to change my project to use v3.0.0.1 I guess.
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.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)
Source Error:
Line 39:
Line 40:
Line 41:
Line 42:
Line 43:
Source File: E:\sitesroot\0\web.config Line: 41
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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].
Thank's guy's. I actually just commented out the assembly line of code for the mvc assemble and changed the runtime binding code to look for v 3.0.0.1 in web.config and this has done the trick. I'm not sure if that was the best solution but having spent over a day on it time was a big factor.
I was getting a very similar error
My solution had previously been working and nothing had changed apart from some activities using source control
I created a completely new workspace and checked out the entire source code again to the new workspace, and this fixed the issue (just doing a 'get' and a 'Get Specific Version' wasn't enough)
Looks like something had got screwed up in my workspace that prevented the compiler from finding the correct .dll. Possibly related to finding it in the GAC?
I have had this problem on and off randomly for a while and I now know why.
When you update a nuget package and the package has a web.config file as part of the nuget package, it merges the content of web.config file in the nuget package with your config file. The nuget package was a private package that I build and didn't realise this.
The web.config file in the package contained the binging redirects for MVC and this causes my config file to suddenly have duplicate entries. I initially missed it because it does all the binding redirects on one line.
Once you remove any duplicate binding redirects it fixes the problem. This question was big clue to me finding out what causes this.
I have a vsixmanifest file that has an assembly attribute. The file looks like:
<Content>
<ProjectTemplate>Solution</ProjectTemplate>
<Assembly AssemblyName="SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7">
Assemblies\SolutionNameWizard.dll
</Assembly>
I know that the assembly name and public key are correct.
Now, I am trying to use this assembly in one of my templates. Right now I have:
<WizardExtension>
<Assembly>SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7</Assembly>
<FullClassName>SolutionNameWizard.IWizardImplementation</FullClassName>
</WizardExtension>
Is there something that I am missing? When I run the vsix I get the following error:
A problem was encountered creating the sub project 'test.Web' Error: this template
attemtped to load component assembly 'SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7'.
I know that templates require the assembly to be in the GAC, is that also the case when I am using vsix? I was hoping to avoid the GAC and still use my wizard.
EDIT: I changed the public key to the proper string as suggested in the answers, but am still having the issue.
Edit 2: in addition to the helpful answer below, here is a blog that I wrote after I finished this process. It links to a bunch of articles that I found to be very helpful: https://thebhwgroup.com/blog/2013/10/visual-studio-templates
If your assembly is being provided via your VSIX, it does not need to be in the GAC.
Your PublicKeyToken is definitely not correct. You're using a Guid when it should be a 16-character hex string (8 bytes). See the following example:
MyAssembly, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
You can find the PublicKeyToken value for your assembly by running sn.exe -T MyAssembly.dll from a VS command prompt.
If anyone else happens to stumble upon this question, I ended up following this guide: http://blog.tonysneed.com/2011/09/14/build-a-multi-project-visual-studio-template/
It made the process (mostly) very easy. If anyone happens to run into similar issues, feel free to contact me and I can try to share what I learned.
Edit: here is short blog article I wrote after completing this process. It might be helpful for someone who stumbles upon this: http://www.thebhwgroup.com/blog/2013/10/visual-studio-templates/
im receiving a very weird error from the IDE while compiling.
C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for
Phone\v4.0\Microsoft.Phone.PreImport.targets(38,9): error : Could not
load file or assembly '0 bytes loaded from System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
what really makes this weird is the fact that on another computer the program is compilable.
thanks for your help
edit: just found out that the reason for that error is because of the panorama -view.. i tried to create a new project with a panorama view, still received same error
Do you have the correct references in the project?
Did you modify any of the "stock" references?
You could try repairing the SDK or create a new Panorama-based application and see if it works.
I have Solution in vs2008 with framework 2.0. Now I migrated solution to vs2010 .net framework 2, and it works.
Here problem occur when I changed framework from 2.0 to 4.0, after that when I run application(win-form) it throws error on resource file saying
"System.IO.FileNotFoundException: Could not load file or assembly
'SpServer.resources, Version=1.0.0.2, Culture=en-US,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified. File name: 'SpServer.resources,
Version=1.0.0.2, Culture=en-US, PublicKeyToken=null' --->
System.IO.FileNotFoundException: Could not load file or assembly
'...SpServer.resources.dll' or one of its dependencies. The system
cannot find the file specified.
I have not made any extra resource file, and assembly was not satellite assembly too before if there is error. Please let me know how to sort out this issue.
From MSDN:
Beginning with the .NET Framework 4, the AssemblyResolve event is raised for satellite assemblies. This change affects an event handler that was written for an earlier version of the .NET Framework, if the handler tries to resolve all assembly load requests. Event handlers that ignore assemblies they do not recognize are not affected by this change: They return null, and normal fallback mechanisms are followed.
Please also see my answer to this question.