Sites that use EF connection strings don't work on Kudu #262

Closed
davidebbo opened this Issue Dec 15, 2012 · 9 comments

Projects

None yet

4 participants

@davidebbo
Member

Repro: deploy https://github.com/KuduApps/MvcApplicationEFSqlCompact to Kudu and run it

Result: it fails with MetadataException: Unable to load the specified metadata resource

@davidebbo
Member

When we build WAPs on Kudu, we use a command line that looks like this (simplifying a bit):

MSBuild.exe MvcApplicationEF\MvcApplicationEF.csproj /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\output"

While it works fine in most scenario, it turns out that it doesn't fully build everything, causing the assembly to be missing it's EF resources. Normally, it looks like this (using reflector)

Capture

But we end up without the whole Resources tree, causing the app to break at runtime.

The fix is to pass an extra /t:Build param to make it do the correct build, e.g.

MSBuild.exe MvcApplicationEF\MvcApplicationEF.csproj /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\output"

We will fix this in Kudu, but in the meantime the same can be achieved using a custom build script, as shown in KuduApps/MvcApplicationEFSqlCompact@b73805e.

@amitapl amitapl was assigned Jan 4, 2013
@davidebbo
Member

@amitapl you fixed this one, right?

@happytrails

Unfortunately this was broken again recently. :( The log shows a few warnings about mismatch between the processor architecture and one error on EF:

SGEN : error : An attempt was made to load an assembly with an incorrect format: \EntityFramework.5.0.0\lib\net45\EntityFramework.dll. [\VirtualDirectory0\site\repository\WebAPI\WebAPI.csproj]
An error has occured during web site deployment.

Again, works fine deploying straight from VS2012. Can someone help look into this? Thanks much!

@davidebbo
Member

@happytrails would you mind opening a new issue to track this new problem, as this looks like a different thing. Thanks!

@amitapl amitapl pushed a commit that referenced this issue Jan 11, 2013
Amit Apple Added /t:Build to msbuild command line to fix issue #262 (for origina…
…l site builder).
093e070
@amitapl
Member
amitapl commented Jan 15, 2013

Fixed, and verified with the repo to make sure it works.

@amitapl amitapl closed this Jan 15, 2013
@amitapl
Member
amitapl commented Jan 15, 2013

Do we want to add a test for this repo?

@davidebbo
Member
@cdohotaru

Hi all,

I'm having the same problem right now on Azure.
Is your fix in production or not yet?

Thank you!
Constantin.

@davidebbo
Member

Sorry, not yet. Hopefully around the end of the month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment