Error Deploying Azure Website from GIT - asp.net-mvc

I'm trying to deploy an ASP.NET MVC5 application on Windows Azure Websites, but keep getting this error on my git push:
All packages listed in packages.config are already installed.
Trex.Web.Common -> D:\home\site\repository\src\Trex.Web.Common\bin\Release\Trex.Web.Common.dll
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\RouteConfig.cs(28,13): error CS1928: 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHttpRoute' and the best extension method overload 'System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(System.Web.Http.HttpRouteCollection, string, string, object)' has some invalid arguments [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\RouteConfig.cs(28,13): error CS1929: Instance argument: cannot convert from 'System.Web.Routing.RouteCollection' to 'System.Web.Http.HttpRouteCollection' [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\RouteConfig.cs(34,13): error CS1928: 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHttpRoute' and the best extension method overload 'System.Web.Http.HttpRouteCollectionExtensions.MapHttpRoute(System.Web.Http.HttpRouteCollection, string, string, object)' has some invalid arguments [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\RouteConfig.cs(34,13): error CS1929: Instance argument: cannot convert from 'System.Web.Routing.RouteCollection' to 'System.Web.Http.HttpRouteCollection' [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
App_Start\TrexAppSetup.cs(112,13): error CS0103: The name 'GlobalConfiguration' does not exist in the current context [D:\home\site\repository\src\Trex.Web.Admin\Trex.Web.Admin.csproj]
Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\src\Trex.Web.
Admin\Trex.Web.Admin.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\DWASFiles\Sites\credli-web-admin-staging\Temp\b5bff328-3b38-49b7-afab-8064f800112f";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository\src\\"
An error has occurred during web site deployment.
I've enabled nuget restore, and I have another MVC4 App that deploys fine.

To help identify the issue, I suggest starting with a clean clone of your repo on your local machine. Then run NuGet restore, and check that all the relative references in your .csproj can be resolved. It looks like it's trying to fall back to the GAC, which usually happens when relative paths are messed up.

Related

Assembly Reference Issue in Xamarin.iOS Project

MTOUCH: error MT2002: Failed to resolve "System.Void
PropertyChanged.ImplementPropertyChangedAttribute::.ctor()" reference
from "MvvmCross.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=null"
Following errors are from Compiling Environment
Mono Framework 4.8.1
Xamarin Studio 6.3(863)
I was getting this when the FodyWeavers.xml file's build action was set to "none" instead of "Content".
I had a similar issue where my PCL was referencing the wrong Newtonsoft.JSON version.
I uninstalled and reinstalled Fody and PropertyChanged.Fody packages. This resolved the issue for me by correcting the references.

Failed to convert 'Microsoft.VisualBasic.Activities.VisualBasicSettings' to type 'System.String'

I am getting this error when my TFS workflow hits the Run On Agent initialization. I tried to revert back the recent changes where I added new variable to the workflow and initialized it, but later I removed it but no luck.\
Run On Agent Exception System.Xaml.XamlObjectReaderException: Failed to convert 'Microsoft.VisualBasic.Activities.VisualBasicSettings' to type 'System.String'. ---> System.TypeLoadException: Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Autofac 3.4 is missing, while 3.5 is called

Attempting to run the MVC 5.2 project, which is built successfuly, got the following error:
An exception of type 'System.IO.FileLoadException' occurred in
ProjectNamespace.WebUI.dll but was not handled in user code
Additional information: Could not load file or assembly 'Autofac,
Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: DisplayName = Autofac, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
(Fully-specified) LOG: Appbase = file:///C:/ProjectPath/WebUI/ LOG:
Initial PrivatePath = C:\ProjectPath\WebUI\bin Calling assembly :
Autofac.Integration.Mvc, Version=3.3.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file:
C:\Users\me\Documents\IISExpress\config\aspnet.config LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Autofac, Version=3.4.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac.DLL. LOG: Attempting
download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac/Autofac.DLL. LOG:
Attempting download of new URL
file:///C:/ProjectPath/WebUI/bin/Autofac.DLL. WRN: Comparing the
assembly name resulted in the mismatch: Minor Version ERR: Failed to
complete setup of assembly (hr = 0x80131040). Probing terminated.
My web.config has the following settings:
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
Spent hours trying to resolve it, but failed. Please help.
This problem has become quite common. It seems to come up when you have the Autofac, Autofac.Mvc5 and Microsoft.AspNet.Mvc>5.1.0 packages, even though Autofac.Mvc5 is stated to work with Microsoft.AspNet.Mvc(≥ 5.1.0 && < 6.0.0).
I suggest the classic solution of checking and adding the appropriate assembly binding redirects for autofac, not only in the project which references it but in projects referencing that project as well.
Another potential problem is having two entries for the
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
in your config, if you have your bindings in the second one move them to the first one. That fixed it for me in a situation where I was also encrypting some configuration settings and for some reason the binding redirects were not copied into the resulting config file.
I highly recommend the Assembly Binding Log Viewer, it helped me a lot in figuring out the issue, even though my final solution was a cowardly one, going to Autofac3.4.0.0 and Microsoft.AspNet.Mvc 5.1.0. I spent way too much time on fixing the problem.
Also, for those who are interested you can use the nuget manager to detect and fill in your assembly binding redirects: Get-Project -All | Add-BindingRedirect (from here). It might need some additions afterwards depending on your porjects and references but at least it's going to give you a clean slate to begin with.
Update
Microsoft.AspNet.Mvc 5.2.3 was released so I decided to try again. I updated every package involved in the "conflict" to the latest version (Autofac 3.5.2, Autofac.Mvc5 3.3.4, Microsoft.AspNet.Mvc 5.2.3). I updated the redirect bindings and it worked.

FSlex/FSyacc crash - can't locate FSharp.Core assembly

I'm having an issue with FSlex/FSyacc crashing on my machine.
In context this is inside Visual Studio 11 beta running on Windows 8 Consumer Preview (32 bit) running inside a Parallels virtual machine.
------ Build started: Project: Basis, Configuration: Debug Any CPU ------ C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1546,5):
warning MSB3245: Could not resolve this reference. Could not locate
the assembly "log4net, Version=1.2.11.0, Culture=neutral,
PublicKeyToken=669e0ddf0bb1aa2a". Check to make sure the assembly
exists on disk. If this reference is required by your code, you may
get compilation errors. Basis ->
C:\Users\nexus\Desktop\Statical\trunk\Statical\Basis\bin\Debug\Basis.dll
------ Build started: Project: Syntax, Configuration: Debug Any CPU ------ cd C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\ CALL C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fsyacc.cmd CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fslex.cmd
Running fsyacc.cmd... CalParser.fsp Running fsyacc.exe... Unhandled
Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. File name: 'FSharp.Core,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at .$FSharp.PowerPack.FsYacc.Driver.main#() WRN:
Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog]. Running fslex.cmd... Not
running fslex.exe as CalLexer.fs is newer than CalLexer.fsl
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1036,5):
error MSB3073: The command "cd
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\ CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fsyacc.cmd CALL
C:\Users\nexus\Desktop\Statical\trunk\Statical\Syntax\fslex.cmd"
exited with code -532459699. Done building project "Syntax.fsproj" --
FAILED.
The relevant piece seems to be this:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. File name: 'FSharp.Core,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at .$FSharp.PowerPack.FsYacc.Driver.main#()
Not sure why it can't locate the FSharp.Core assembly.
Ideas?
I had forgotten to install F# 2.0. There was a dependency on that.

ASP.NET MVC with Mono

I'm trying to develop an app with ASP.NET MVC Mono.
Installed latest version of Mono and Monodevelop. While trying to run a default "Welcome to ASP.NET MVC on Mono!" app I get the following errors:
Server Error in '/' Application.
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 'System.Web.Mvc,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Source Error:
Line 34: Line 35: Line 36: Line 37: Line 38:
Source File: C:\Users\Sergey\Desktop\mvc\mvc\web.config Line: 36
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.Mvc, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.4927;
ASP.NET Version:2.0.50727.4927
Tried putting System.Web.Mvc.dll from C:\Program Files\Mono-2.10.6\lib\mono\2.0 to bin\ - app still doesn't run, I just get
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
instead of
The system cannot find the file specified.
What should I do?
P.S. My OS is Windows 7.
As suggested in the comment, I'm posting this as an answer ;) When trying to run application which references Mono's assemblies, one can try running it with Mono (not .NET what MonoDevelop does as default) as it uses different GAC.

Resources