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

IHostingEnvironment Updates #633

Closed
davidfowl opened this issue Mar 10, 2016 · 9 comments
Closed

IHostingEnvironment Updates #633

davidfowl opened this issue Mar 10, 2016 · 9 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

See discussion at aspnet/PlatformAbstractions#26. We're going to leave out IApplicationEnvironment as it's intended as a pure BCL abstraction API and instead we're going to add the ContentRootPath property (and maybe file provider) to IHostingEnvironment.

/cc @DamianEdwards @lodejard @JunTaoLuo

@davidfowl davidfowl added this to the 1.0.0-rc2 milestone Mar 10, 2016
@davidfowl
Copy link
Member Author

public interface IHostingEnvironment
{
    ... 

    string ContentRootPath { get; set; }
    IFileProvider ContentRootFileProvider { get; set; }

    string WebRootPath { get; set; }
    IFileProvider WebRootFileProvider { get; set; }
    ...
}

@halter73
Copy link
Member

When I saw ContentRoot, I assumed that it was the wwwroot directory.

It seems that isn't the case, but instead ContentRoot is really what I'd expect to be ApplicationRoot and WebRoot is where I put my static content. I don't have a big problem with WebRoot, but ContentRoot is misleading.

@JunTaoLuo
Copy link
Contributor

We had this conversation last week. I believe @DamianEdwards mentioned that elsewhere they were using something like contentBase as application base and we should follow the precedence.

@DamianEdwards
Copy link
Member

The prior art I was referring to was the msbuild "build action" concept where "Content" meant it's not input to the compiler, but may get copied to the output, depending on the value of the "Copy to output dir" setting. That, and there isn't really another good name for it :sad: but I'm all ears on suggestions.

@JunTaoLuo JunTaoLuo changed the title Add ContentRootPath to IHostingEnvironment IHostingEnvironment Updates Mar 15, 2016
@JunTaoLuo
Copy link
Contributor

We made the following changes in our updates in IHostingEnvironment:

  • Added ApplicationName. This replaces IApplicationEnvironment.ApplicationName but otherwise contain the same information.
  • Added ContentRootPath. This replaces IApplicationEnvironment.ApplicationBasePath but otherwise contain the same information.
  • Removed Configuration
  • Removed MapPath

@robbaman
Copy link

The announcement also mentions the removal of the MapPath(string virtualPath) method. Is there still a way to do what MapPath used to do?

@davidfowl
Copy link
Member Author

I added a code snippet to the announcement to show the MapPath replacement.

@pranavkm
Copy link
Contributor

Could we create a separate discussion work item for this?

@JunTaoLuo
Copy link
Contributor

I'll move it #651

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