MvcSiteMapProvider.dll not working in Visual Studio 2013 - asp.net-mvc

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at
Html.MvcSiteMap().SiteMapPath
The error message is
An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code
I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.

Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.
NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.
But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.
Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

Related

Upgrading to Visual Studio 2015 renders intellisense broken for project

I've been through a lot of similar issues, but could not find anything that worked for me.
I'm upgrading my IDE from the VisualStudio for Web (v10) to Visual Studio 2015 (v14, I guess) Community Edition.
The main project that I'm trying to use on the new IDE is a MVC 5 (5.2.3), with EF 6.1 (6.1.3) and a bunch of other stuff.
Problem is: When opening the project on the new IDE, everything looks fine (it even compiles and work). I got the MVC context menu working on the project explorer (showing the "Add Controller..." and "Add View..." when appropriate). Only (really annoying) thing is the Razor Intellisense.
When I do open a View file (.cshtml) I receive warnings on several helpers, some of the "using" are greyed out (even though they're supposed to be needed) and the #model myModel is shown like everything after the #model directive is not razor (it's treated like HTML by the intellisense coloring).
What I've already found and tried:
I've already tried to clear the UserData from the vs (devenv /ResetUserData)
I've already tried to run the VS2015 in safe mode
I've already tried to run VS2015 as Administrator
I've already tried to set the Project's target framework to 4.5.1 (used to be 4.5)
I've already tried to open the project on Visual Studio Community 2013 saving it there before trying to use it on VS2015.
When creating another MVC project from the VS2015, everything works fine.
Here's an example of the annoying issue:
Ok, finally got it.
Posting what I found out believing it may help someone else:
What seems to cause the problem mentioned is the fact that the project was created on an old MVC version (with older Razor, EF, etc).
As stated in this answer: Visual Studio 2015 Razor View MVC Types not recognized, VS2015 tools may not work for older MVCs.
The solution is to update all your packages to [at least] the minor versions accepted on newer MVC (5?). To do so you can use the list in this website: http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2.
Once everything is up-to-date, open the web.config files located on root of your application and on the Views folder. In there, you will probably find some references to the older versions of MVC and Razor. Update those versions values (all of them) to match the updated versions of your packages (you may create a new empty MVC project on the new Visual Studio and check for those values as a hint of what they should be).
This step is the catch! Since, even if you update you project's packages, some web.config references may still mention the original versions.
Clean the solution (Build > Clean Solution) and close the project. Reopen and compile it. Now [hopefully] everything should be working fine.
[Edit]
One more thing: If your project was also updated from Framework 4.5 to 4.5.1 during this IDE transition, you should also install a NuGet package called "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" (as stated in https://support.microsoft.com/en-us/kb/3025133).

TFS Build - iSeries Reference

I am working through setting up our first build definition through TFS 2013. I have worked through all of the errors (mostly missing reference files) except one:
Type 'iDB2Command' is not defined.
The type is part of IBM.Data.DB2.iSeries.dll, which I have placed on the build server in the appropriate location. I am really at a loss as to what to do in this situation.
Obviously building through Visual Studio works just fine. The file is not registerable. The iSeries client/SDK installs are not necessary (I do not have them on my machine, and I can build).
My best guess is that it wants the .NET 2.0 SDK (TFS is running on Windows Server 2013 and I already had to install several versions of the Windows and .NET SDKs).
How do I get my build to see this file and complete?
Ultimately this appears to have been a permissions issue. By following advice similar to the answer to this question (which I had to do for the Excel reference), I needed to put the IBM DLL into a Libs folder within the Team Project.
Once I did this, and updated the references in the solution, the build worked just fine.

this template attempted to load component assembly Microsoft.VisualStudio.Web.Project

I just installed Visual Studio 2013 Ultimate trial version for completing the MVC5 tutorial by Rick Anderson, which worht doing it.
The tutorial: http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started.
However, I created a blank solution first and then try to add an ASP.Net Application project, which is going to be my MVC5 tutorial project. And I got this weird message:
Error: this template attempted to load component assembly
'Microsoft.VisualStudio.Web.Project, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. For more information on this problem
and how to enable this template, please see documentation on
Customizing Project Templates.
But I´m not customizing, I´m just creating a project out of a built in template.
Do you know how can I solve it?
Here is the solution:
In Visual Studio 2013, select Tools > Extensions and Updates
Check for updates. You should have the Azure SDK update available.
Download and install the Azure SDK. After this, everything should work fine.
If your updates are not turned on, enable your auto detection of updates in Tools > Options > Environment > Extensions.
If you have unspecified error related to E_fail(code), try this:
When creating a new MVC 5 application, change the framework version from 4.5.1 to 4.5, if that did not work change it to 4. Check the below image if it is not clear.
Another approach:
This is really important if you are installing Visual Studio 2013 on un-updated Windows 7.
there reason i am calling out "not updated is",
The reason that 'un-updated' matters is because Visual studio 2013 does not update the powershell that is required by VS2013 for most of the stuff.
The simple solution is to update Powershell to the latest version.
If you are not sure how to update powershell, you can use this tutorial.
So I stumbled upon this issue as well and would like to share how I was able to resolve this problem.
Tools -> Extensions and Updates -> Online -> NGet Package Manager: Click the download button once you have the NGet Package Manager selected. Make sure to restart your Visual Studio after you have downloaded the Manager.
This should do the trick
Close Visual Studio, run the VS executable with the command line option as shown below (you will likely have to supply the full path), and relaunch VS normally. This should re-initialize the templates, including the one that you are having problems with.
devenv.exe /installvstemplates
So I faced the same problem with Visual Studio 2013, and I don't know what's the problem but it appears that it only occurs when creating a new project, and choosing "Web" from the panel.
What I did was simply clicking on "Visual Studio 2012" just below it, and it worked !

VSIX Custom Checkin Policy not loading

I'm attempting to modify a custom Checkin Policy to work against Visual Studio 2013.
At first, I attempted to just add a new section to the manifest for 2013:
<VisualStudio Version="12.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
</VisualStudio>
and whilst this allowed it to install, it doesn't allow the policy to run (if I go to the policies>>Add section of TFS it's not present, and the policies throws an exception stating that the Policy is not registered).
After much hunting around, I thought perhaps there was an issue with the Policies.pkgdef - The Extension manager in VS2013 shows it as installed, but it's not showing as installed at Pending Changes. However I can't see any issue with it either:
[$RootKey$\TeamFoundation\SourceControl\Checkin Policies]
"VersionOneTFSPolicy"="$PackageFolder$\VersionOneTFSPolicy.dll"
I've opened it and compiled it in 2013, and fixed any reference issues so that it will compile correctly, but it still doesn't seem to like using it.
Does VS2013 manage Custom Checkin policies differently to 2010/2012? From what I can see it should just work with a manifest change and a recompile.
Edit
So I managed to get the custom policy running on VS2013 by upgrading the reference to Microsoft.TeamFoundation.VersionControl.Client from 11 to 12 and upgrading the project to .Net 4.5. However, this now renders the custom policy unusable on VS2012 (and I would assume 2010 too but I haven't tested that yet). Is there a way to have this run on 2010 through to 2013 from a single VSIX?
In the absence of any other solution, I reverted to the tried and tested method of updating the extension and building it as a new package. So simply having a 2012 version and a completely separate 2013 version.
I am trying to solve this as well, and from everything I have found, the only way to get extensions that target all versions is to actually create 3 separate (2010, 2012 and 2013) extensions, and install them using an InstallShield package that has each one as sub-features that get installed in sequence.
Upgrades are then done on each one individually as the VSIX is actually doing the install.
Links that may help you out on this include:
Single extension targeting VS 2012 and VS 2013
How to target an extension in both VS2012 and VS2010

Installing a modified version of ASP.NET MVC

I have made a relatively simple change to the MVC 1.0 source code to correct a bug in the DropDownList HtmlHelper (discussed in another question).
I was able to rebuild the MVC solution, ran all the tests, including the one I hadd added to show the bug I was fixing, and built a new DLL.
But how do I use that?
I tried moving the new MVC dll into the project and changing all the project references to point to it, but when I try to run the MVC website, it's throwing an exception saying there's a conflict between my version of MVC and the MVC in the GAC.
I tried to use gacutil.exe to remove the one from the GAC, but it says it can't do that because it would make another program (the Microsoft Installer? fail.
What do I have to do to install my newly built version in place of the "official" version?
If you want to remove it from the GAC without uninstalling MVC (which includes the Visual Studio templates you probably need), you need to do this in the registry:
Find registry key HKEY_CLASSES_ROOT\Installer\Assemblies\Global and look for key starting with System.Web.Mvc – delete it
Now you should be able to use gacutil.exe to remove System.Web.Mvc from the GAC, and you should be able to use your version from your /bin folder.
How about changing the version number when you compile the modified MVC framework?

Resources