English 中文(简体)
Azure application service is missing .css file content
原标题:

I finally have my Blazor .Net 6 application working as an Azure app service. One last problem I can t figure out, I m missing css from my project s wwwroot folder. But the font-icons are all there.

enter image description here

when I load the site no css has been applied and there is nothing in the Style Editor window

enter image description here

I m using Azure DevOps pipeline to deploy the code and I m fairly certain that s where the problem lies but I haven t found much on SO or general Google searches looking for "Azure app service missing css". Here is my .yaml file

# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4

trigger:
- master

pool:
  vmImage:  windows-latest 

variables:
  solution:  **/*.sln 
  buildPlatform:  Any CPU 
  buildConfiguration:  Release 

steps:
- task: NuGetToolInstaller@1

- task: DotNetCoreCLI@2
  inputs:
    command:  restore 
    restoreSolution:  **/*.sln 
    feedsToUse:  config 
    nugetConfigPath: nuget.config

- task: VSBuild@1
  inputs:
    solution:  $(solution) 
    msbuildArgs:  /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:UseWPP_CopyWebApplication=true  /p:OutDir="$(build.artifactstagingdirectory)" 
    configuration:  $(buildConfiguration)   

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile:  $(Build.ArtifactStagingDirectory) 
    includeRootFolder: false
    archiveType:  zip 
    archiveFile:  $(System.DefaultWorkingDirectory)/deploy.zip 
    replaceExistingArchive: true
    
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish:  $(System.DefaultWorkingDirectory) 
    ArtifactName:  drop 
    publishLocation:  Container 
    
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType:  AzureRM 
    azureSubscription:  <sub name>(2442165c-339d-4e83-a443-*******) 
    appType:  webAppLinux 
    WebAppName:  hrchangemanagement 
    deployToSlotOrASE: false
    ResourceGroupName:  HRChangeManagement 
    packageForLinux:  $(System.DefaultWorkingDirectory)/deploy.zip 
    RuntimeStack:  DOTNETCORE|6.0 
    StartupCommand:  dotnet "HR Taxonomy Change Management.dll" 


Any suggestions you have are welcomed!

问题回答

When building Web App, the wwwroot folder will not be automatically copied to the output directory (OutDir) of the build by default. Same behavior when building both in Azure Pipelines and on local machines.

To let the wwwroot folder can be automatically copied to the output directory when building the Web App. You can add below command to the Post-build event of your project file (for example, MyWebApp.csproj).

xcopy .wwwroot $(OutDir)wwwroot /s /i
  • The .wwwroot is the relative path of wwwroot folder in the project. Replace it with the actual relative path in your project if it is different than this one.
  • The $(OutDir)wwwroot is the target path that the wwwroot folder will be copied to. You also can change it to a different path based on your actual requirements.

See below example as reference:

  • Settings on the project.

    enter image description here

    enter image description here

  • Result.

    enter image description here





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签