error in installing Package Microsoft.AspNet.SignalR - asp.net

I am trying to install Microsoft.AspNet.SignalR from NuGet and get the following error:
'Microsoft.Owin.Security 2.0.2'. You are trying to install this
package into a project that targets '.NETFramework,Version=v4.0', but
the package does not contain any assembly references or content files
that are compatible with that framework. For more information, conta
ct the package author.
Has anyone encountered this, and knows what the solution is?

SignalR 2.0 does not support .net 4.0. Either do a upgrade of .net or use a 1.x version of SignalR.
>Install-Package Microsoft.AspNet.SignalR -Version 1.1.3
source

Another option is upgrading from Framework 4.0 to Framework 4.5.
Go to the "WEBSITE > Start Options" in the Visual Studio menu, and then change your "Target Framework" to 4.5.
Also make sure that controlRenderingCompatibilityVersion (if used) is also 4.5 in your web.config.
<system.web>
<compilation debug="true" targetFramework="4.5" />
<pages controlRenderingCompatibilityVersion="4.5" />
</system.web>

Related

Why is my ASP.NET Web Site project targeting .NET Framework 4.6.1 when I have told it to target 4.8?

We have a large Visual Studio 2015 solution with several Web Site (as opposed to Web Application) projects and dozens of business-logic DLL projects. We were targeting .NET Framework 4.6.1, but I've now installed Visual Studio 2019 on my local PC and re-targeted all the projects to 4.8
When I build the solution using our existing PowerShell/MSBuild script, all the DLLs build successfully, but I get the following error when it comes to our first Web Site project:
C:\[omitted]_MyWebSite.metaproj : warning MSB3274: The primary reference
"C:\[omitted]\MyDLL.dll" could not be resolved
because it was built against the ".NETFramework,Version=v4.8"
framework. This is a higher version than the currently targeted
framework ".NETFramework,Version=v4.6.1".
Then later, when the compiler reaches some code on the site that tries to use the DLL:
c:\[omitted]MyController.cs(6): error CS0246: The type or namespace
name 'MyDLL' could not be found (are you missing a using directive or
an assembly reference?) [C:\[omitted]_MyWebSite.metaproj]
(This is just a sample reference error. In fact, all of the DLLs seem to suffer from this issue wherever they are used in the Web Site project.)
Relevant lines in the site's web.config file:
<location path="." inheritInChildApplications="false">
<system.web>
[omitted]
<httpRuntime targetFramework="4.8" requestValidationMode="2.0" maxRequestLength="10240" />
<compilation debug="true" strict="false" explicit="true" targetFramework="4.8">
I am using the following MSBuild.exe path:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\msbuild.exe -maxcpucount:1 -verbosity:detailed
Looks like it's not enough to update the web.config file for Web Site Projects. You also have to update the target in the property pages. So in Solution Explorer, find your Web Site Project, right-click > Property Pages > Build > Target Framework > change to .NET Framework 4.8.
This is independent of the web.config file and resulted in a change in my .sln file from:
ProjectSection(WebsiteProperties) = preProject
[...omitted...]
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.1"
to:
ProjectSection(WebsiteProperties) = preProject
[...omitted...]
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.8"

Configuration Error - targetFramework

Getting this error:
The 'targetFramework' attribute in the element of the
Web.config file is used only to target version 4.0 and later of the
.NET Framework (for example, '').
The 'targetFramework' attribute currently references a version that is
later than the installed version of the .NET Framework. Specify a
valid target version of the .NET Framework, or install the required
version of the .NET Framework.
Source File: E:\website.com\dir\dir\web.config Line: 34
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.6.1069.1
The line referenced in the error message is:
<compilation debug="false" targetFramework="4.6.1" />
When I look up the solution to this error all I find are thing that say that the framework referenced in the code isn't installed on the server, but as you can see the ASP.Net Version and the targetFramework are both 4.6.1. Any Ideas?

Dropbox.API Nuget update to 3.0.1 gives CS0012 compilation error for System.Object on ASP.Net MVC 5 view

I updated the Dropbox.API Nuget-package to 3.0.1 from 2.3.6 and now I'm getting the error
The type System.Object is defined in an assembly that is not referenced. You must add a reference to assembly System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
The following is marked red under source of error, but it's NOT my code
Line 31: public class _Page_Views_Dropbox_Index_cshtml : System.Web.Mvc.WebViewPage {
I tested to run the code with 2.3.6 just before updating and it all worked.
The compilation information box says
Microsoft (R) Visual C# Compiler version 4.6.1038.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
I have .Net 4.6.1 as target framework though.
Is this a bug in Dropbox's package so I should downgrade until they have fixed it or do I need to change something with code relating to MembersListResult?
Update
Dropbox has now fixed this issue with the update to package version 3.0.2.
I found the following information http://www.lyalin.com/2014/04/25/the-type-system-object-is-defined-in-an-assembly-that-is-not-reference-mvc-pcl-issue/
I tried adding only <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> under <assemblies>. I skipped adding <compilation debug="true" targetFramework="4.5"> since that feels related to the older framework that I'm not using.
It's now working, but after reading this from Microsoft, it looks like Dropbox did something wrong when compiling the Nuget-package https://support.microsoft.com/en-us/kb/2971005

Oracle.ManagedDataAccess The system cannot find the file specified

In my website project built on .net 3.5, when I add reference to the Oracle.ManagedDataAccess.dll by adding this in the web.config
<add assembly="Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
it give this error
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 'Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
This error comes at .net version 3.5
The solution is to upgrade the .net version to .net 4.0 or above
Upgraded my project version to .NET 4.8 from .NET 4.5.2 and then
Installed the OracleManagedDataAccess nuget package into the solution (seems it wasn't installed)
This resolved the error.

Change webserver used by Flex in FlexBuilder to .NET Framework 3.5

I just had to reformat and reinstall Flex and reconstruct a project.
The problem is i am using ASP.NET as my server side technology and using LINQ in my files. The version of WebDev.Webserver.exe that FlexBuilder starts up is the wrong version so I get this error :
Compiler Error Message: CS0234: The
type or namespace name 'Linq' does not
exist in the namespace 'System' (are
you missing an assembly reference?)
Microsoft (R) Visual C# 2005 Compiler
version 8.00.50727.3053 for Microsoft
(R) Windows (R) 2005 Framework version
2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights
reserved.
I know that changing to the latest version of ASP.NET / Framework will fix this - but I just can't figure out HOW to make that change in Flexbuilder. I cant even remember if i ever successfully did it before or if I just created a virtual directory in IIS7.
Where would I change the version?
It turned out I only had a very minimal web.config file set up.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
Once I opened the project in Visual Studio (which I hadn't done) - it upgraded the web.config to one of those really long ones and then the 3.5 framework was used. I didn't have to make any changes in the Flex environment.

Resources