0

I have a 3-projects solution structure (Client,Server,Shared) in Visual Studio 2019. What I exactly did to create it can be described as:

  • [GUI] BlazorApp -> Blazor WebAssembly App -> checbox ticked [v] ASP.NET Core hosted

which is equal to:

  • [CMD] dotnet new blazorwasm --hosted

I would like to deploy this projects to Azure, but I am facing some problems:

  1. When I tried to use continous GitHub deploy and attached my branch to it, I got error which basically said that 3.1 version is not supported (highest was 3.0). It's weird, while setting up WebApp server on Azure I chose .NET Core 3.1 (LTS) option [hosted on Linux, no other option]
  2. If I would like to publish it manually from VS2019, which "project" should I deploy?

I assume that this 3-project template is just a friendly hand from Microsoft so I don't have to create 2 separate project and what I am trying to do could be done just by deploying two separate WebApps:

  1. REST API built with .NET Core 3.1 ( mix .Shared and .Server projects OR just create WebAPI project)
  2. Blazor WebAssembly App (so called client-side)

Although, if this can be done all at once - I would prefer it.


Thank You in advance!


EDIT 1 (10.03.20 10:15)

This is my *.yml file:

trigger:
- master

pool:
  vmImage: 'windows-latest'

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

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish $(buildConfiguration)'
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

- task: PublishBuildArtifacts@1
  displayName: 'publish artifacts'

Configuration of WebApp:

  • Publish: Code

  • Runtime stack: .NET Core 3.1 (LTS)

  • OS: Linux

EDIT 2 (10.03.20 10:31)

Got the following error:

Error: More than one package matched with specified pattern: D:\a\r1\a**.zip. Please restrain the search pattern.*

EDIT 3 (10.03.20 10:15)

Build finally succeded, after I changed the specific zip file from this list (all the items in this folder are visible on a screenshot. I chose WebApp.zip) But - I go to the url and I am only seeing "Your app service is up and running" default screen..

Build folder

2

2 Answers 2

2

I ran into this same issue, instead of going through Github directly, I used Azure DevOps to pull from Github, build and then deploy to my webapp.

You'll find a great tutorial here.

https://youtu.be/jRgLSMlp28U

Sign up to request clarification or add additional context in comments.

5 Comments

Sounds interesting, I will try it, hope it won't be messy with all the resources groups, plans, web apps and dbs. Is iit possible to use DevOps using a free 12-month plan (student)?
Absolutely, it shouldn't be an issue. I'm fairly new to this as well, but with DevOps you should be able to do just about everything you need.
I tried to do it as it was shown on the video, but had a problem with targetting a *.zip file. It tells that there more than one and it does not know which one to targer...
I'll try to look deeper into it today to see if I can figure it out.
Can you share your YAML file?
0

Azure build agents don't have the latest .NET SDK installed. Add this to your yaml file:

- task: UseDotNet@2
  displayName: 'Use latest preview of .Net Core sdk 3.x'
  inputs:
    version: 3.x
    includePreviewVersions: true

1 Comment

Also, I had a problem deploying preview DLLs to Linux WebApp. I created a windows WebApp and the deployment succeeded. Ping me if you need more details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.