error when deployed to azure - asp.net

When i Publish my project i m getting this error:
error CS0009: Metadata file
'D:\home\site\approot\packages\Microsoft.ApplicationInsights\1.1.1-beta\lib\net45\Microsoft.ApplicationInsights.dll'
could not be opened -- Invalid COR20 header signature.
(I m using asp.net core 1)
Did Someone knows or has experienced the same problem?
Thanks

This problem can occur when you have added a third-party DLL to your application and have not properly added it to your compiler’s project file or references list.
If that's the case this might work:
Open your project in Visual Studio .NET. Make sure the DLL exists and has been properly added to the reference list. If you are using VBC or CSC to compile your project, check your application’s CompileApplication.rsp file to make sure the DLL is in the /references list like the other DLLs.
Your DLL may not be compatible with .NET or with .NET’s 32-bit mode. Ensure that your DLL is .NET compatible.
If your project still won’t compile properly, try switching your application’s compiler selection in Iron Speed Designer’s Application Wizard from 'vbc.exe' or ‘csc.exe’ to Visual Studio .NET or vice versa. Using Visual Studio .NET will take longer to build than .NET’s VBC or CSC built-in compilers, but Visual Studio .NET will resolve all of the references properly without having to change your application’s CompileApplication.rsp file.

Related

Error System.NotSupportedException on Razor Pages Project

After researching a lot and finding nothing about it, I decided to ask for collaboration here in the community.
I am trying to perform run in Visual Studio 2019 from a Razor Pages project, created in the 2017 version of Visual Studio. The Target Framework is net461.
However, the following error occurs:
NotSupportedException: Attempting to load an assembly from a network
location that would cause the assembly to be in safe mode in earlier
versions of the .NET Framework. This version of the .NET Framework
does not enable CAS policy by default, so this loading can be
dangerous. If it does not intend to confine the assembly, enable the
loadFromRemoteSources option.
I am not loading any assemblies over the network. All files are on my computer. Also, all exe, dll files are unlocked.
Error is in the startup.cs:
services.AddMvc()
I greatly appreciate any help.
are you creating .NET 4.6.* project or .Net Core? For .Net Core the target framework should be .NET Core 2.* or 3.* and make sure SDK is installed on your machine.

TFS2013: code does not compile on Buildbox but does on Dev box

I have an Asp.net 4.0 solution that compiles properly on each local development machine using VS2010 but when I run a build on our build box it gives me this error
ASPNETCOMPILER: Could not load file or assembly 'MagickNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I have installed Imagemagik on the build box which has the VC++ runtime required, changed the build configuration to Mixed Platform, Any CPU; but still the error keeps coming. The buildbox doesn't have any visual studio installation. Its a win2012 R2 server with .Net 4.0 framework installed. What could be the problem?
Have you tried forcing a 32-bit process? This is a common source of problems.
This option is in the Build Definition under Advanced, MSBuild Platform.
You can troubleshoot the dependencies for MagickNet using a tool like ILSpy or Reflector.

Error: This assembly is built by a runtime newer than the currently loaded runtime

I have downloaded published (code behind files are no there, combined with dll in bin folder) web application from Window Server 2008 where it is hosted, and open it with Visual Studio when I debug that application it shows following error:
"Could not load assembly because this assembly is built by a runtime newer than the currently loaded runtime"
I don't know how can I solve this problem and test application locally.
Please help me.
This errors happens when the DotNet framework you are using is of older version than the one used to build the assembly. You need to check which version of framework is used to build those assemblies and then use the same or higher to debug too.
I was getting this same error when running an installer for a Windows service, even when running the installer on the PC the installer was built on.
It turned out that although the Windows service project had been updated to .NET 4.5, the Setup project that was making the installer was still set to use .NET 2.0.
To check if the Setup project is using an older version of .NET than the project to be installed, in the Visual Studio Solution Explorer:
Expand the Setup project;
Under the Setup project, expand Detected Dependencies;
Under Detected Dependencies select Microsoft .NET Framework and check the Version property. Select the appropriate .NET version from the dropdown list;
Re-build the Setup project to create a new version of the installer.
This error can have a lot of other reasons, too. I had the same problem, and nothing helped until I stumbled across this:
TlbExp.exe error:This assembly is built by a runtime newer
I just ran into this issue when the assembly was built with a target framework of .NET 4, and v4.0.30319 was installed on the server, and other 4.0 apps were running successfully.
The problem arose because the app had originally been built targeting 2.0, and new 4.0 assemblies were pushed, but not the app.config file, which we generally update separately.
This means the supportedRuntime attribute was not updated in the config and caused the error. Adding the following to the app.config fixed our issue:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
One the the assemblies reference in the project might be built using a newer version of .net, check version of every assembly reference and correct accordingly.
Also check the application pool that this web site is running as. It could be framework 2.0 default on some older windows servers. Change it to framework 4.0.

Error message about existing

I'm using VS 2010 with ASP.net MVC 2.
I recieved a program that was completed and when I was debugging the program I recieve an error message.
"Error 4 The type 'System.Web.Routing.RouteTable' exists in both 'C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Global.asax.cs"
and
"Error 1 The type 'System.Web.Routing.RequestContext' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'c:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Controllers\AccountController.cs".
The program was converted into VS 2010 format.
What should I do?
// Fullmetalboy
When you convert a project from .Net 2.0/3.5 to 4.0 in VS2010 the web projects will prompt you to upgrade the framework to 4.0 but you will need to manually go into the project properties and upgrade class library projects and certain other projects manually in the project properties. So this type of error is probably caused by your web project referencing the 4.0 version of System.Web.Routing but a class library in your solution is still referencing the 3.5 version.
One of the projects in your solution is referencing a single type (RouteTable/RequestContext) in two different places. I always start with cleaning and rebuilding the solution, but if that doesn't fix it, you're going to have to check the project references and resolve it that way. If all else fails, try to make a new project from scratch and manually add the references and projects you need and then copy and paste your old code.
Someone copied the ASP.NET MVC source code into the "lib" folder of your application and either included that folder in the project (so it is getting built when you build your project) or he/she built it before you got it and referenced it from within the project. Now it is in conflict with the ASP.NET libraries that exist in default installation folder on the system 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll'.
Since you're using the .NET 4.0 Framework, the library System.Web.Routing is ambiguous. Make sure you have referenced System.Web.dll (version 4.0) and remove the reference to System.Web.Routing.dll

Visual Studio 2010 build with wrong framework

I'm working on Visual Studio Profesionnal 2010.
In my solution I've got 2 projects
The first is a web site with targeted .net runtime 2.0
the second is a dll with targeted .net runtime 2.0
I add the output of the second as assembly of the first.
I build and rebuild and clean my solution
result : Build succeeded
But when I launch the projet in my web-browser ( in debug or release ).
I've got the Server Error :
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded
Is there someone who had already the problem?
I think it can be a bug from Visual Studio 2010 but the hotline is very expensive
300€ the phone call.
More Information :
I opended my dll with reflector and saw that mscorlib is referenced 2 times
the first time Version = 2.0
and the second time version = 4.0
Open the .csproj file with text editor (e.g. Notepad) and see the references in there.
If there are references to frameworks higher than 2.0 remove them or change to 2.0 if possible, save and reload the project.
I am pretty sure that this means that you built with asp.net framework 3.5x, but your server only has 3.0x. Update the runtime on the server.
Your server can only support 3.0, Updating the server will resolve the issue..

Resources