Could not load file or assembly WebGrease,dll Version Clash - asp.net

This problems is nagging me from last night ,I can't figure out its solution.
Well let me explain the structure of my project,In a single solution file I have three projects two are asp.net mvc 4 projects and one in C# Library,the problem started when I added new asp.net mvc 4 project.
I have tried several solutions ,but they didn't worked for me,
nuget restore (first I deleted the whole package folder then applied
nuget restore).
Tried uninstalling asp.net web optimization package then
webgrease and then installed them both.
Tried cleaning temp folder of asp.net.
Removed xmlns from web.config assemblyBinding tag
Note:
By using the first solution I was able to fix the problem on my home dev machine,but the same solution doesn't works on my office dev machine :(
I have also discussed this problem on asp.net chat before posting question here.
Assembly binding log aka FusionLog Viewer
tried several SO solutions.
Update:
Moved the two MVC4 webapp in seperate solutions,so one solution is
working fine but another is having same webgrease problem.
Solution:
Check my answer below for the solution which worked in my situation.

If your solution it's for 64-bit and the dll-s are for 32 bit, go to:
IIS / Application Pools
Right click your website app pool / advanced settings
Set 'Enable 32-bit Applications' to TRUE

Hi guys,
So I merged my both solutions,now both mvc4 projects along with a test case project and C# Class library project are in the same solution.
I finally made it work for me,here are the steps with the nuget console commands
uninstall-Package Microsoft.AspNet.Web.Optimization
uninstall-Package webgrease
Install-Package Microsoft.AspNet.Web.Optimization -Version 1.1.0
Note:
I was having WebGrease 1.5.2 and Microsoft.AspNet.Web.Optimization 1.1.3 in my project and I had to rollback to earlier version to make it work.

Related

Net Core 2.1 install Entity Framework Core does not work?

I create a new project using VS2017, select new Console App (Core) version 2.1; etc. When I use NuGet to install the Entity Framewwork Core, version 2.1.1, it is not installing to the Assemblies directory but instead appears under the NuGet directory. When I try to add a migration using the package manager I get a 'The term 'add-migration' is not recognized' error. I have reviewed the other SO answers to this problem, and searched google, but none of those helped.
I have another project, it's an older one from several months ago, where the Entity Framework Core was installed under the Assemblies directory and for that project everything seems to work.
From the above it appears that where NuGet places the Entity Framework Core dll is the only difference and it is causing the package manager to fail to find it.
The get-module command for the older project shows the Entity Framework Core and the correct version, but get-module for the new project does not.
Any thoughts on why this is happening and how I can fix it?
From this post :
The solution that worked for me after trying a whole raft of other solutions posted, was to right click on my project => select 'Manage Nuget Packages' => select the browse tab, but thick 'Include prerelease' check box, and install the 'Microsoft.EntityFrameworkCore.Tools'. N.b that aspnetcore project in visual studio 2017 do not seem to have the 'project.json' file.

NuGet Server for .NET Core

The NuGet.Server package is used to create a ASP.NET MVC NuGet server and it works just fine. There is another package NuGet.Server.Core that is expected to do the same when hosted within a ASP.NET Core (perhaps 1.0 or 1.1?).
The first one creates 'Packages' folder right beneath the main folder used as a package repository.
No such things happens after installing the Core version. I tried both root and a dedicated folder. Googling a bit, I found no info about installing the package and integrating it in a ASP.NET Core app.
Has anyone succeeded in installing the Core version? Also, there's another version NuGet.Server.V2 which depends on NuGet.Server.Core, however it requires .NET Framework 4.6.1. This makes me think that NuGet.Server.Core is not targetting .NET Core at all.
If so, the name must be somewhat misleading, I guess...
Yes, this is the answer:
No .NET Core whatsoever! Just .NET Framework 4.6.1. Not a big discovery but a warning to all devs who, like me, were (and, more importantly, will be!) misled by 'Core' in the package's name.
Here's a 3rd party option (free)
https://github.com/loic-sharma/BaGet
Nuget.Server.Core seems to be one of the dependencies of Nuget.Server. So it's not a .NET Core project. Guess that's one of those snags you run into when you call your framework "Core". :)
I think you can use BaGet.
There is my article about that.
Check this :
Create your own NuGet server and package feed

Umbraco 7.2.8 configuration error after nuget installation in VS2015

I'm using VS2015 Community. I've created an empty ASP.NET project and installed Umbraco from NuGet package manager by following:
Install-Package UmbracoCms
During the installation I've selected to overwrite web.config and Global.asax files.
I've successfully logged into Umbraco but made no changes. Then I tried to load the default home page and I got this configuration error.
I've been looking for solution and found out that you need to upgrade your project to MVC5 when using VS2015. So I did as it is described here:
https://umbraco.com/follow-us/blog-archive/2015/7/29/upgrading-your-umbraco-site-to-mvc5-and-webapi2
Sadly, I'm still getting the same config error. What might went wrong or how to fix it?
I tested this by installing Umbraco via Nuget in VS 2005. I’m using VS 2005, but I think the behavior would be the same for VS 2005 Community. First, I installed it in an empty project and left WebForms, MVC and Web API checkboxes unchecked while creating the new project. I built and ran the project and ran the umbraco installer. The front end loads fine.
I then tried again but this time leaving the MVC checkbox checked. I was able to run and install umbraco, but this time I got the same error you reported on the front end (root page). With this version, I see that there are 2 section groups with the name "system.web.webPages.razor” in views/web.config. I commented out the second one and I also commented out the second in group. After that, the front end seems to work. I had installed the Fanoe starter kit and the pages load fine.

System.IdentityModel.Protocols.WSTrust; Not Found

I been beating my head against the wall trying to get this to work. I have a project I did a while ago that used JWT to authenticate users. When I copied the template code from one project to the other, It claimed to be missing a package or libary. I check nuget and apparently I have installed the latest version of the frameworks I need.
Any suggestions for what i am doing wrong?
Check if the assembly is showing any warnings under Project -> References. I've sometimes found that one has a warning. Most commonly this is because there is a mismatch in the .Net version.
I've had a package add a .net 4.5.2 assembly into a project targeting .net 4.5 which exhibited similar behavior.

How to obtain System.Web.Http.Tracing.dll?

I read about Web API having its own TraceWriter implementation with 2012.2, for example here, among other sources.
I am now using VS2013 with .NET 4.5.1 and the EnableSystemDiagnosticsTracing is nowhere to be found. It's meant to be defined in the HttpConfigurationTracingExtensions class which resides in the System.Web.Http.Tracing.dll. However, this assembly is nowhere to be found - not in list of assemblies in the Add Reference dialog, not in GAC.
Where is this assembly supposed to come from? Docs say it's part of .NET Framework 4, which I have installed. Also installed the ASP.NET Web API 2 Tracing 5.0.0 NuGet package. Is there some update? Should I re-install .NET Framework?
I know it's not a big deal to implement ITraceWriter myself but it bothers me not to know what happened with the built-in implementation.
Just install needed NuGet Package
Install-Package Microsoft.AspNet.WebApi.Tracing -Version 5.0.0
It's a little bit strange, but it is the right package
http://www.nuget.org/packages/microsoft.aspnet.webapi.tracing
If you installed the Tracing 5.0.0 NuGet package, it should be correctly included in your project. The moment it is installed, I believe a separate text file should open in VS showing the code you should include in your WebApiConfig.cs file.
I haven't created a Web API 2 project from scratch (only upgraded from pre-5.0 to 5.0 projects), but this is the code that should reside in your WebApiConfig.cs file:
// To disable tracing in your application, please comment out or remove the following line of code
// For more information, refer to: http://www.asp.net/web-api
config.EnableSystemDiagnosticsTracing();
And that should be it, if the package is installed correctly, tracing should now be used in your project.

Resources