GithubHelp home page GithubHelp logo

dotnetdevops / dotnetdevops.extensions.azurefunctions Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 91 KB

Extensions for Azure Functions to run AspNetCore applications.

C# 100.00%
aspnetcore azurefunctions

dotnetdevops.extensions.azurefunctions's Introduction

DotNetDevOps

.Net Devops Website

Build status Release status

dotnetdevops.extensions.azurefunctions's People

Contributors

pksorensen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

espray jammanaraj

dotnetdevops.extensions.azurefunctions's Issues

how to best handle Razor pages when running locally

Given the following context: a MyNamespace.FunctionHost project with an azure function and a MyNamespace.AspNetCoreWebsite with a aspnet core website with razor pages and referencing the website from the function project.

When building the azure function project, it copies over all the dlls and put them in a bin folder under the function output.
image

Note that the compiled razor views are there too, but not placed in the bin folder.

<RazorCompileOnBuild>True</RazorCompileOnBuild>
<RazorCompileOnPublish>True</RazorCompileOnPublish>
<RazorEmbeddedResource>True</RazorEmbeddedResource>
<PreserveCompilationContext>true</PreserveCompilationContext>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>

When publishing the function project, the output also contains the wwwroot and appsettings files.
image

Everything actually runs with func host start in the published output folder.

But when running from visual studio with/without debug (F5), it results in razor issues:
image

I suspect that the issue here is related to that I in the implementation here for the aspnet core runner, is setting the contentPath(when running with environment=development) to the website project folder - meaning that it properly also detects the /Pages/* razor .cshtml files in the project folder. (Assumption correct?)
image

The reason that I made this development attribute to change content path, is because as outlined above - that when running in visual studio it do not do a full publish and the content files are not copied over and the only idea I had to fix that was to change the content path.

So how do we create a better development experience for this? Are there any magic way to make the build also copy over content files for the function project when F5? Or is the best way to set content path? If so, how do we then make sure that razor works?

I think when vs runs a aspnet core site, it also is setting content path to the project folder. Is this not what makes you able to change wwwroot files and they are reflected right away without rebuild?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.