I can't seem to get SignalR 3 working on ASP .Net 5 RC-1 upgrading from Beta8. I tried the latest RC1 package for SignalR but had the following problem. I tried the "Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-15810" package
services.AddSignalR();
is causing the following error:
The type 'IServiceCollection' is defined in an assembly that is not
referenced. You must add a reference to assembly
'Microsoft.Extensions.DependencyInjection.Abstractions,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
and app.UseSignalR();
is causing this one:
The type 'IApplicationBuilder' is defined in an assembly that is not
referenced. You must add a reference to assembly
'Microsoft.AspNet.Http.Abstractions, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'.
When I switch to the "Microsoft.AspNet.SignalR.Server": "3.0.0-rc2-15909" package I get a runtime error:
An exception of type 'System.TypeLoadException' occurred in
mscorlib.dll but was not handled in user code
Additional information: Could not load type
'Microsoft.AspNet.Http.RequestDelegate' from assembly
'Microsoft.AspNet.Http.Abstractions, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=adb9793829ddae60'.
I've just tested this, and it looks like a reference to the aspnetmaster myget feed is required, even though this is not mentioned in the installation docs.
Prior to including aspnetmaster I could only resolve Microsoft.AspNet.SignalR.Server 3.0.0-rc1-15810 either directly or by specifying rc1-*, which does not build against rc1-final. Including aspnetmaster gives access to rc1-final.
If you're using Visual Studio 2015, go to Tools > Options > Nuget Package Manager > Package Sources and add a new feed called whatever you like but with source set to https://www.myget.org/F/aspnetmaster/api/v3/index.json.
If you're not using VS2015, or you don't want to edit your machine-wide config, add/edit NuGet.config in your solution root directory to include a package source as follows;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="aspnetmaster" value="https://www.myget.org/F/aspnetmaster/api/v3/index.json" />
</packageSources>
</configuration>
Use MyGet sources for "Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-final"
Here related answer, that can be helpful:
Can't find Microsoft.AspNet.SignalR.Server 3.0.0-beta7
For anyone who is looking at this page now, the aspnetmaster feed has removed "Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-final"
Related
I have a web project build on .net framework 4.5.1. We are trying to added PostgreSQL support for the project. Using Nuget, I have installed 4.0.4 npgsql to the project. Under references, I see the following being added to the project.
Npgsql - 4.0.4.0 - Runtime version v4.0.30319
System.Threading.Tasks.Extensions - 4.2.0.0 - Runtime version v4.0.30319
When I tried run the project and connect and get the data from the database, I am getting the following error saying FileNotFoundException:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'com.rsol.RConfig' threw an exception.
Source=RConfig
StackTrace:
at com.rsol.RConfig.getInstance() in C:\Workspaces\PS\RConfig\RConfig.cs:line 1113
at RAdmin.Global.Application_Start(Object sender, EventArgs e) in C:\Workspaces\PS\RAdmin\Global.asax.cs:line 528
Inner Exception 1:
TypeInitializationException: The type initializer for 'com.rsol.Db.DbMgr' threw an exception.
Inner Exception 2:
FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Inner Exception 3:
FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
System.Threading.Tasks.Extensions which is installed using Nuget is not getting loaded to the project. When I checked the properties of System.Threading.Tasks.Extensions reference, the dll file exists in the location. I have also tried installing System.Threading.Tasks.Extensions.dll file to assembly using gacutil. I am still getting the same error.
Please let me know if you need any additional information.
Any help is really appreciated.
In my case, I got the issue after upgrading to version 4.5.4 and tried #user2713341 answer. It didn't work but put me in the right direction.
My project had no bindings for this library, so I added the binding and it worked
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
and it worked.
Note that it should be 4.2.0.1 even though the version is 4.5.4.
Update Nuget Package
https://www.nuget.org/packages/System.Threading.Tasks.Extensions/
will solve your problem
Update Nuget Package is not working for me.
What works?
In app.config need to change
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
To
<bindingRedirect oldVersion="0.0.0.0-4.5.4" newVersion="4.5.4" />
for current version 4.7.2 should work.
Microsoft like ;)
The response from #Keyjote was at the root of the solution for me, but rather than cherry-picking the assemblies, I was able to just reinstall. This seemed to automatically repair the app.config file.
Tools -> Nuget Packet Manager -> Packet Manager Console
Update-Package -reinstall -Project <your project name>
This way you don't need to mess with the syntax or have to figure out the PublicKeyToken values.
If you want to do it for the whole solution, you can omit the -Project <> parameter.
I got the error in a different context when trying to migrate using Entity Framework Core (EFC) Version 3.1.8 using the Package Manager Console. The project built successfully.
Trying the binding redirects as suggested in this thread and (re)installing different versions of System.Threading.Tasks.Extensions as well as EFC (as suggested also elsewhere) did not work for me.
I managed to solve the problem by
deleting the packages/ directory in my project's root directory
using manual NuGet Package Restore (link to Microsoft Docs) via Visual Studio
problem lies in *.csproj file. having wrong reference for System.Threading.Tasks.Extensions.4.5.4 because this dll not loading.
after referring correct framework version folder from lib its start working
old Reference:
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
corrected one:
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net472\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
please clean the nuget cache first, then run test case it will work
I have been struggling a lot with bindingRedirect.
I finally found a real gotcha that solved my problems.
I have a WCF server project in .net 4.8, depending on projects in .net standard 2.0.
I was updating Nuget packages in the referred projects.
I got al sorts of problems, I won't try to mention them here.
I had bindingRedirects in web.config. I had to rediscover that those were unnecessary, and maybe even conflicting, because of automatic generation of those into the dll.config. There are various aspects to make that work, see elsewhere.
But the real gotcha for me was that for IIS, I had to LINK web.config to the dll.config. The latter being the complete config-file, with all the bindingRedirects, which turned out to be working after all.
Try to download the package and add reference to your project explicitly . should work , I just resolved it .
I got a similar error message - but for a different reason. In packages.config set by NUGET manager There was a ref for the new version - but in project reference there was a ref for an old version. The solution - delete the ref in project reference
I'm trying to build a CI pipeline for a Xamarin iOS project with Jenkins, but I'm running into errors with MSBuild not finding a reference to the .NET Standard library:
IDebugSettingService.cs(8,22): error CS0012: The type 'IDisposable' 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'.
ViewModels/IPresentationTabViewModel.cs(17,15): error CS0012: The type 'MulticastDelegate' 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'.
ViewModels/ICredentials.cs(17,10): error CS0012: The type 'Attribute' 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'.
I can build the project successfully on my account on the Mac build machine, but the Jenkins service account always fails here. I've tried clearing and restoring all the NuGet packages, and the MSBuild logs aren't much help, although MSBuild seems to load significantly less assemblies when run with Jenkins than when run by me.
Is this a problem with how my project is set up, or is it a problem with Jenkins?
It turns out the PATH environment variable on the Jenkins account was missing the /usr/local/share/dotnet path and couldn't access NuGetFallbackFolder (where the NETStandard.Library reference is located) as a result.
Adding /usr/local/share/dotnet to PATH fixed the build.
Add $Path like i have added
Path=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$Path:/usr/local/share/dotnet
Using VS2017, I've created a ClassLibrary (.NET Framework 4.6.2) in an empty solution. Then I've installed System.Net.Http 4.3.2 package there and used HttpClient class in a Class1 constructor.
Then I've created a ConsoleApp (.NET Framework 4.6.2), referenced ClassLibrary and instantiated Class1 in the Main method.
Now running ConsoleApp causes runtime exception:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. at
ClassLibrary1.Class1..ctor() at ConsoleApp1.Program.Main(String[]
args) in [...]
In detailed build log I see this message:
2> There was a conflict between "System.Net.Http, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and
"System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
2> "System.Net.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and
"System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" was not.
Let's suppose I can not remove reference to System.Net.Http from ConsoleApp, because I have this situation in a real project structure.
Playing with Specific Version parameter of System.Net.Http
reference did not help.
Specifying <bindingRedirect oldVersion="0.0.0.0-4.1.1.1"
newVersion="4.1.1.1" /> did not help
I've googled it and it is a popular problem, but I didn't find a clear explanation of what actually happens and how to fix such cases in general.
Could not load file or assembly System.Net.Http version 4.1.1.0
Could not load file or assembly 'System.Net.Http' or one of its dependencies
About conflicts:
What does .NET mean by 'primary' when choosing between conflict dll reference?
Found conflicts between different versions of the same dependent assembly that could not be resolved error
I wonder why you are choosing to use the NuGet package instead of using the Reference Manager to load in the appropriate assembly. By default in a lot of project templates VS includes System.Net.Http. If it is the case that you used the NuGet package explorer to install the assembly, then one of the two options should help out:
Remove the NuGet package and use the assigned version from the Reference Manager (look under Assemblies / Framework) though I am betting this is already selected.
In the Reference Manager un-select the assigned version of System.Net.Http and use the one that you installed with NuGet.
Personally I think option 1 is better unless you absolutely need something specific found only in the NuGet latest version.
The best and easiest way to fix this issue, is with a binding redirect, as said. But the versioning looks off.
Simply specify the oldVersion as 0.0.0.0-5.0.0.0, and newVersion as 4.1.1.0
Where 4.1.1.0 is your version, for example.
I am using .NET Core 1.0 Framework to connect to a MySql database. Since the references does not have MySQL.data dll I added it to the project, but it is throwing the error for System.Data. I added the reference for system.dll as well, and since There is no project.json in this template, I added the reference manually in .csproj file.
But when I am building the project it is still throwing an error.
I installed the nuget package for MvcMailer, found here. Although it didn't (as it says in the tutorial it will) add smtp configuration to web.config, I found the correct smtp configuration here.
I'm using MVC4 in VS2010.
When I compile, I get the following error in the the error list:
Error 1 Assembly 'Mvc.Mailer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\Home\Desktop\MVCMusicStore - Copy\packages\MvcMailer.4.0\lib\40\Mvc.Mailer.dll MVCMusicStore
I also get the following warning:
Warning 2 Found conflicts between different versions of the same dependent assembly. MVCMusicStore
I removed the MvcMailer reference and added it again, but it didn't resolve the issue.
Help would be much appreciated.
I'm using Mvc 4, and was installing MvcMailer via the package manager with the following:
install-package MvcMailer
Because I'm using Mvc 4, the following should be used:
install-package MvcMailer3
This has resolved the issue.