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/
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.
While I know this has been "answered" about 50 million times, I haven't found an answer that fixes the issue for me, so I feel like I have no choice but to ask again.
Previous suggestions:
Razor pages in MVC are giving a compile error with System.Web.Helpers not being found
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
I have added this to my web.config, but the issue remains.
Type or namespace name does not exist
I only have one project, and the targetFramework is 4.0.
I installed Microsoft.Web.Helpers 1.15 (2.0 is incompatible with MVC3.) The Microsoft.Web.Helpers.dll is in my bin folder.
The odd thing is that there's Microsoft.Web.Helpers and System.Web.Helpers. I need System.Web.Helpers in this case, because I'm using WebImage in my code.
As I keep telling people, it's when I ask for help that I find the answer. In my case, somehow in the process of destroying my Solution earlier by upgrading to Microsoft ASP.NET Helper Library 2.0 and then trying to undo that action, System.Web.Helpers stopped being a referenced assembly in my project. Simple fix!
Of course, fixing that led me to the next Assembly Reference error. I think I'll be here all night.
Could not load file or assembly 'EntityFramework, Version=4.3.1.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I only get this error when I add this code into my project:
private IUserRepository repository;
public SearchController(IUserRepository repo)
{
repository = repo;
}
I suppose that makes sense as I'm using EntityFramework for this. I'm just now sure how to fix this bug.
I've looked at this link: http://msdn.microsoft.com/en-us/library/e74a18c4.aspx
Though I'm not sure how to use this program? (It's always blank).
I think that this bug may have something to do with the fact that my database is hosted by dotnet-host.com and that there's some local references that break when it interacts with the database online.
What the error is telling you is that your project referenced a different version of EntityFramework.dll than it found at runtime.
Check which version of EntityFramework.dll did you reference in your project (update your question).
Make sure you copy all the relevant dll and *.manifest into application's bin folder.
Since It's an external host, You might need to install the EntityFramework through WebMatrix Package Manager. If you do, you can follow this tutorial.
Just make sure to install the same version of EntityFramework on your host site that you use for development, or
change your assembly reference to Specific Version = false on EntityFramework dlls (Note I'm not sure if it will work, because I always try to develop and deploy using the same versions, so maybe somebody can confirm?).
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