Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Azure / Kudu - Git deploy of beta7 and dnx451 #2656

Closed
ealsur opened this issue Sep 8, 2015 · 21 comments
Closed

Azure / Kudu - Git deploy of beta7 and dnx451 #2656

ealsur opened this issue Sep 8, 2015 · 21 comments
Assignees
Milestone

Comments

@ealsur
Copy link

ealsur commented Sep 8, 2015

When publishing on an Azure Web App using beta7 packages (MVC6 + dependencies) with a global.json:

{
    "sdk": {
        "version": "1.0.0-beta7"
    }
}

We get a "Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1'
capture

We tried using dnx46, dnx452, they all work locally but all fail on an Azure deploy, maybe its a Kudu related problem?

@davidfowl
Copy link
Member

@ealsur Can you provide repro steps?

@davidebbo
Copy link

Can you please provide a repo that repros this issue? Please see https://github.com/projectkudu/kudu/wiki/Using-a-git-repo-to-report-an-issue. Thanks!

@muratg
Copy link
Contributor

muratg commented Sep 9, 2015

cc @anurse (as he tested this scenario)

@ealsur
Copy link
Author

ealsur commented Sep 9, 2015

@davidfowl @davidebbo Sure, here is the link of the repo I'm using to test: https://github.com/ealsur/meetup

Here is a site that has Continuous Integration on Azure Web Apps pointed to that repo: http://gitgit.azurewebsites.net/

I can run it locally with no problems, it blows up if I use the Continuous Integration through Kudu.

@davidebbo
Copy link

Thanks, I can repro with your repo, though I don't know what's wrong. The packages are all there under D:\home\site\approot\packages.

Here is the full error. @davidfowl, any idea why it's failing to find packages?

[InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
   Microsoft.AspNet.Antiforgery 1.0.0-beta7
   Microsoft.AspNet.Authorization 1.0.0-beta7
   Microsoft.AspNet.Cors.Core 1.0.0-beta7
   // many more here

Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
 Version:      1.0.0-beta7-15532
 Type:         CLR
 Architecture: x86
 OS Name:      Windows
 OS Version:   6.2.9200.0
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +506

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +4531288
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +94
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +191

@davidfowl
Copy link
Member

Found the issue, we have a bug where having the project.json and global.json in the same folder causes problems.

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidfowl Glad you found it :) Is there anything I can do to help with it?

@davidfowl davidfowl added the bug label Sep 10, 2015
@davidfowl
Copy link
Member

@ealsur How did you create the project?

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidfowl manually using VS Code, originally I had the problem that Kudu was detecting beta6 (projectkudu/kudu#1663) when pulling the deployment script, @DamianEdwards recommended me to use the global.json, which worked (Kudu pulled beta7) but generated this other problem.

@hoetz
Copy link

hoetz commented Sep 10, 2015

In my case, I created the project with VS2015 and VS added the global.json into my Web project, probably to select the proper dnx version. After removing the global.json on my azure web app everything started to work again.

@davidebbo
Copy link

What I found in VS is:

  • if I check Create directory for solution, I get a global.json at the root (so not same folder as project.json).
  • if I don't check it, project.json is at the root, but I don't get a global.json at all!

The second case looks broken. @hoetz it's strange that it works differently for you. I have Azure tools v2.7 for VS 2015.

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidebbo project.json can be on other folder other than the root and Kudu/VS will parse it? All the examples I've seen on the MVC repo (https://github.com/aspnet/Mvc/tree/dev/samples/MvcSample.Web) use it on the root.

@davidebbo
Copy link

@ealsur correct, it does not have to be at the root. See https://github.com/davidebbo-test/AspNet5Beta7, which is an unmodified VS-create project, with Create directory for solution checked. It works fine in Kudu.

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidebbo Problem is that it works when using a Solution, if you create the web app using VS Code or pulling from Yeoman or the MVC sample repo there's no SLN file to specify that the project is on another folder, so your project.json ends up in the same folder than the global.json :(

@hoetz
Copy link

hoetz commented Sep 10, 2015

@davidebbo probably because I opened the project.json directly with Visual Studio 2015.

@davidfowl
Copy link
Member

Yes, it's a bug with publish but it's only happens when these websites are hand crafted manually. Customers end up with 2 global.json files in their published artifacts and one of them end up pointing to a packages folder that doesn't exist. It happens when you have a global.json and a project.json in the same folder.

We'll fix this in the next release but the work around is the get rid of the global.json or to restructure your project to have a different global.json root and project root.

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidfowl If I get rid of global.json I end up with Kudu not detecting Beta7 and thinking it's Beta6.
capture

capture

In the meantime, I rollbacked the whole web app to Beta6 (no global.json) and it's working :)

@davidfowl
Copy link
Member

You can use the other suggestion. Change the site structure to look like this:

src/
     myapp/project.json
global.json

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidfowl Wouldn't I need an SLN / Xproj file for that? Thinking on the no-VisualStudio scenario and going on VS Code, does Kudu / DNX realize that my structure is different?

@davidfowl
Copy link
Member

You don't need an xproj or solution for that. It's simply moving the project file from the root of the repository as a workaround for a bug that exists in beta7.

@ealsur
Copy link
Author

ealsur commented Sep 10, 2015

@davidfowl Did it (https://github.com/ealsur/meetup) and it works locally and deploying it to Azure, I didn't know that the project.json file got detected even if it was on a subfolder, learning something new everyday :) You rock.

@davidfowl davidfowl added this to the 1.0.0-beta8 milestone Sep 10, 2015
@davidfowl davidfowl self-assigned this Sep 10, 2015
@davidfowl davidfowl assigned JunTaoLuo and unassigned davidfowl Sep 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants