Closed jhigh2000 closed 6 months ago
Can you please share your repo? Thanks!
yes, thank you!
Here is what I tried:
So in other words, I have not been able to repro the issue. What is the name of your test site that's broken?
I'm sorry to say that I have not been able to repro the BadImageFormat exception in my test project yet (only in my live site). I suspect it's caused by a referenced assembly or nuget package and the presence of mscorlib.dll that gets copied to the bin folder when targeting 4.5.2. If I manually delete mscorlib.dll via the kudu console, I can get the site to load.
I agree that the log is showing warnings and not errors, but the inconsistent presence or absence of mscorlib.dll in the bin folder is of concern.
However, using the test repo I above, I get clean deploy.cmd logs (with no mscorlib.dll in the bin folder) when targeting 4.5.1, but that doesn't appear to match what you're seeing. Btw, I'm also verifying that both compilation and httpRuntime under
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
All packages listed in packages.config are already installed.
azure-test.web -> D:\home\site\repository\azure-test.web\azure-test.web\bin\azure-test.web.dll
Transformed Web.config using D:\home\site\repository\azure-test.web\azure-test.web\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
Copying all files to temporary location below for package/publish:
D:\local\Temp\4ddccaf4-602a-4094-a3dd-b6fe3155cd9f.
KuduSync.NET from: 'D:\local\Temp\4ddccaf4-602a-4094-a3dd-b6fe3155cd9f' to: 'D:\home\site\wwwroot'
Copying file: 'Web.config'
Copying file: 'bin\azure-test.web.dll'
Finished successfully.
Here is exactly what I'm doing:
git reset --hard HEAD~
to get back to 4.5.1I agree that something strange is at play, but it would be good to get to a point where we observe the same behavior.
Could you please try a deployment against commit 194a358? That one is 100% clean for me, no warnings.
Indeed. And no mscorlib in bin. So yes, there is indeed something funky going on with 4.5.2. The runtime is definitely installed, but we may be missing some SDK/libs.
I see, looking at D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
, we have:
02/06/2015 12:02 AM <DIR> v4.0
02/06/2015 12:02 AM <DIR> v4.5
02/06/2015 12:02 AM <DIR> v4.5.1
On my local machine, I have a v4.5.2
in there. So I think the issue is clear: we need to get the reference assemblies updated.
That would certainly explain it! Thanks for looking into it!
This should be fixed in Azure now. I verified using your azure-test
repo. Please give it a try now.
v4.5.2 reference assemblies are in place now and deployments from github work as expected. Thank you!
Hello @davidebbo and @ahmelsayed, I'm having a very similar issue here with our Azure Website after upgrading to .NET 4.5.2
Here is part of deployment output:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
All packages listed in packages.config are already installed.
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Microsoft.Practices.Unity" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "Microsoft.Practices.Unity" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [D:\home\site\repository\Descomplica.Common\Descomplica.Common.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Microsoft.Practices.Unity.Interception" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "Microsoft.Practices.Unity.Interception" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [D:\home\site\repository\Descomplica.Common\Descomplica.Common.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [D:\home\site\repository\Descomplica.Common\Descomplica.Common.csproj]
DependencyInjection\CommonUnityInjection.cs(10,21): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\Descomplica.Common\Descomplica.Common.csproj]
InterceptionBehaviors\ExceptionLoggingInterceptionBehavior.cs(13,21): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\Descomplica.Common\Descomplica.Common.csproj]
Reading this issue I cannot find any tips on what to do to get this working. Deploying directly from VS (web deploy) works fine. Can you help?
Thanks, Marcelo
Probably not quite the same issue, since we now have all the .NET 4.5.2 ref assemblies (look in D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2
).
Your issue sounds like http://unity.codeplex.com/workitem/12756, which it seems some people were seeing outside of Azure.
Thanks. What is curious is that our project builds on our CI and locally. Both have .NET 4.5.2 Developer Pack installed. Publish directly from VS also works fine (http://descomplica-test2-g.azurewebsites.net).
It really seems that only with Kudu's GitHub-to-Azure deployment the problem happens.
Yes, based on http://support.microsoft.com/en-us/kb/2971005, it sounds like the fix would be to install the .NET 4.5.2 Developer Pack on the Kudu build machine.
Just wanted to pipe in a bit of context around #1538. This prevents sites targeting .Net 4.5.2 with Application Insights installed from building and/or running correctly when deployed via kudu.
Application insights is selected by default with current versions of VS 2013, but the build warnings do not always cause an outright build failure in kudu. The deployment will say it was successful, but the site will fail in the browser when the application insights module tries to load at runtime. To my mind, this is much worse than an outright build failure --with a failure, at least the previous successful build stays online.
In the application insights case, the build will only fail if custom code in the application makes direct reference to something in the application insights or bcl namespaces. In either case, the cause of the problem is not easily apparent from the content of the logs, even with the log verbosity turned up to diagnostic level.
We are seeing this issue also. Azure 4.5.2 64bit. Git deploy
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.2". To resolve this problem, either remove the reference "Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
...
error CS0246: The type or namespace name 'Serilog' could not be found (are you missing a using directive or an assembly reference?)
/cc @shobak101
To give an update, to fix to this is coming within the next couple weeks.
I just updated to the latest application insights, and git deployment is now working with kudu. Not sure if kudu got an upgrade, of if it was the new packages, but thanks either way!
I am also experiencing @dlfu's issue with Serilog
Indeed, the fix is not yet deployed.
I was having a similar problem in pushing from 4.5.2 from git to Azure. The problem was that Git was not pushing Microsoft.Owin.Host.SystemWeb.dll automatically. I manually copied the file using the debug console on Azure, and the site began to work. Where does Git publish pick up the files it needs to publish?
Hi
Kudu will continue to run in Azure App Service. However, this repo will no longer be maintained. If the problem persists and is related to running on Azure App Service, please open a support incident in Azure: https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request
This way we can better track and assist you on this case
Thanks,
Joaquin Vano Azure App Service
I'm unable to successfully complete a github-to-azure triggered website deployment of a vanilla File...New..asp.net mvc 5 project that is targeting .NET framework 4.5.2. The main concern is that the msbuild failure causes mscorlib.dll to be bin-deployed which then results in a BadImageFormat exception. The deployment works as expected if I target .NET 4.5.1. I can also target 4.5.2 and publish directly from visual studio without any problems.
deploy.cmd output:
Command: "D:\home\site\deployments\tools\deploy.cmd" Handling .NET Web Application deployment. All packages listed in packages.config are already installed.
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
Consider app.config remapping of assembly "mscorlib, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [D:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [D:\Windows\assembly\GAC_MSIL\System\2.0.0.0b77a5c561934e089\System.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0b77a5c561934e089\System.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Security, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "2.0.0.0" [D:\Windows\assembly\GAC_MSIL\System.Security\2.0.0.0b03f5f7f11d50a3a\System.Security.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Security.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Configuration, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "2.0.0.0" [D:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0b03f5f7f11d50a3a\System.Configuration.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Configuration.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Data.SqlXml, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [D:\Windows\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0b77a5c561934e089\System.Data.SqlXml.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0b77a5c561934e089\System.Data.SqlXml.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Xml, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [D:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0b77a5c561934e089\System.Xml.dll] to Version "4.0.0.0" [D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0b77a5c561934e089\System.Xml.dll] to solve conflict and get rid of warning.
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "D:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.EnterpriseServices", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Web", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [D:\home\site\repository\azure-test.web\azure-test.web\azure-test.web.csproj]
azure-test.web -> D:\home\site\repository\azure-test.web\azure-test.web\bin\azure-test.web.dll
Transformed Web.config using D:\home\site\repository\azure-test.web\azure-test.web\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
Copying all files to temporary location below for package/publish:
D:\local\Temp\b26e43f8-1ddc-4e7a-ae6c-a7b822a393d6.
KuduSync.NET from: 'D:\local\Temp\b26e43f8-1ddc-4e7a-ae6c-a7b822a393d6' to: 'D:\home\site\wwwroot'
Copying file: 'Web.config'
Copying file: 'bin\Antlr3.Runtime.dll'
Copying file: 'bin\azure-test.web.dll'
Copying file: 'bin\EntityFramework.dll'
Copying file: 'bin\EntityFramework.SqlServer.dll'
Copying file: 'bin\Microsoft.AspNet.Identity.Core.dll'
Copying file: 'bin\Microsoft.AspNet.Identity.EntityFramework.dll'
Copying file: 'bin\Microsoft.AspNet.Identity.Owin.dll'
Copying file: 'bin\Microsoft.Owin.dll'
Copying file: 'bin\Microsoft.Owin.Host.SystemWeb.dll'
Copying file: 'bin\Microsoft.Owin.Security.Cookies.dll'
Copying file: 'bin\Microsoft.Owin.Security.dll'
Copying file: 'bin\Microsoft.Owin.Security.Facebook.dll'
Copying file: 'bin\Microsoft.Owin.Security.Google.dll'
Copying file: 'bin\Microsoft.Owin.Security.MicrosoftAccount.dll'
Copying file: 'bin\Microsoft.Owin.Security.OAuth.dll'
Copying file: 'bin\Microsoft.Owin.Security.Twitter.dll'
Copying file: 'bin\Microsoft.Web.Infrastructure.dll'
Copying file: 'bin\mscorlib.dll'
Copying file: 'bin\Newtonsoft.Json.dll'
Copying file: 'bin\normidna.nlp'
Copying file: 'bin\normnfc.nlp'
Copying file: 'bin\normnfd.nlp'
Copying file: 'bin\normnfkc.nlp'
Copying file: 'bin\normnfkd.nlp'
Copying file: 'bin\Owin.dll'
Copying file: 'bin\System.Web.Helpers.dll'
Copying file: 'bin\System.Web.Mvc.dll'
Copying file: 'bin\System.Web.Optimization.dll'
Copying file: 'bin\System.Web.Razor.dll'
Copying file: 'bin\System.Web.WebPages.Deployment.dll'
Copying file: 'bin\System.Web.WebPages.dll'
Copying file: 'bin\System.Web.WebPages.Razor.dll'
Copying file: 'bin\WebGrease.dll'
Finished successfully.