Deploying a Blazor Azure Static Web App through a bitbucket pipeline - yaml

I'm currently developing a Blazor WebAssembly application that will be deployed on an Azure Static Web App through a BitBucket pipeline.
pipelines:
branches:
main:
- step:
name: Deploy to test
deployment: test
script:
- pipe: microsoft/azure-static-web-apps-deploy:main
variables:
APP_LOCATION: "$BITBUCKET_CLONE_DIR/PriorityCasesClient/PriorityCasesClient"
OUTPUT_LOCATION: "$BITBUCKET_CLONE_DIR/PriorityCasesClient/PriorityCasesClient/wwwroot"
API_TOKEN: $deployment_token
I however keep running into below error when Oryx is trying to build the solution.
It seems that the pipeline points to the correct locations and the solution is found and correctly restored, as can be seen below, but when Roslyn kicks in it hits me with the following:
error MSB6004: The specified task executable location "/ (deleted)" is invalid
Successfully installed workload(s) wasm-tools.
Determining projects to restore...
Restored /opt/atlassian/pipelines/agent/build/PriorityCasesClient/PriorityCasesClient/PriorityCasesClient.csproj (in 1.84 sec).
Publishing to directory /bin/staticsites/ss-oryx/app...
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
/opt/dotnet/6.0.301/sdk/6.0.301/Roslyn/Microsoft.CSharp.Core.targets(75,5): error MSB6004: The specified task executable location "/ (deleted)" is invalid. [/opt/atlassian/pipelines/agent/build/PriorityCasesClient/PriorityCasesClient/PriorityCasesClient.csproj]
---End of Oryx build logs---
Oryx has failed to build the solution.
Can anyone possible see something wrong with my pipeline, or point me in a direction?

Related

How do I add the 'Name' parameter to an 'Install MSI' task in Azure DevOps?

I'm using an 'Install MSI' task to install an msi file as part of a deployment. The task is throwing the error:
2022-02-22T06:42:35.0716371Z ActionData: Updating component registration
2022-02-22T06:42:35.0839323Z ##[error]Unable to process command '##vso[task.logdetail id=5c578bc6-8e75-4147-992e-fe8cd643eaa2;parentid=00000000-0000-0000-0000-000000000000;name=;type=release;order=1]Updating component registration' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2022-02-22T06:42:35.0888633Z ##[error]Name is required for this new timeline record.
I'm using Azure DevOps on a local Team Foundation Server for the build and deploy process. From the error message I can see that the 'Name' parameter is missing. The deployment works fine when I'm installing to physical machines, but gives the above error when I'm installing to virtual machines.
There were apparently lots of people who had variants of this issue back in 2016, like this guy on social.msdn or this guy on github or this guy on SO. Apparently in 2016 it was possible to turn off "Record project details", however this option is not available in newer versions of Azure Devops.
Does anyone know how to fix this issue in newer versions of Azure DevOps?
Versions: Azure DevOps Server 2020 Update 1.1, Agent 2.153.1, Install MSI 0.1.20.
More a workaround than an answer, but I ended up switching the 'Install MSI' task to a regular 'Command line ' task.
Using the command line with the 'msiexec' command lets you install msi files just as easily as using the 'Install MSI' task.

Error: Error: read ECONNRESET Packages failed to restore

I am trying to restore NuGet packages from the Azure Artifacts feed with the task "Nuget restore" which is giving an error -
2020-03-17T06:16:01.923910Z Resolved from tool cache: 4.1.0
2020-03-17T06:16:01.939365Z Using version: 4.1.0
2020-03-17T06:16:01.924520Z Found tool in cache: NuGet 4.1.0 x64
2020-03-17T06:16:02.080668Z [command]C:\Windows\system32\chcp.com 65001
2020-03-17T06:16:02.007116Z Active code page: 65001
2020-03-17T06:16:02.012223Z Detected NuGet version 4.1.0.2450 / 4.1.0
2020-03-17T06:16:02.081611Z SYSTEMVSSCONNECTION exists true
2020-03-17T06:16:04.157611Z ##[error]Error: Error: read ECONNRESET
2020-03-17T06:16:04.190260Z ##[error]Packages failed to restore
Details -
Server - Azure DevOps server 2019
Azure DevOps build pipeline
Azure Artifacts Feed - offline
Agent Version 2.144.2
What I noticed
my "Nuget Restore" task is working well when my build machine is in the same LAN with azure DevOps server and giving an error with the different LAN's build machine.
I googled but did not find anything. some pages showing this error is because of the proxy, some page is showing version issue of NuGet.
Not getting what exactly the issue is. Can someone help with this?

Build solution and start IIS Express with .bat file (without opening Visual Studio)

For local development purposes, I'd like to just run a .bat file to build my solution and run it on iis express.
Here's what I've got:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
devenv "C:\Path\To\Solution.sln" /build debug
echo "Web build completed. Launching IIS..."
CD "C:\Program Files (x86)\IIS Express\"
iisexpress /path:C:\Path\To\Webroot /port:58389 /clr:v4.0
This does indeed successfully build the solution and start iis express.
Here's my output:
[vcvarsall.bat] Environment initialized for: 'x86'
Microsoft Visual Studio 2017 Version 15.0.28010.2050.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: PDS.Utilities, Configuration: Debug Any CPU ------
2>------ Build started: Project: PDS.Ibex, Configuration: Debug Any CPU ------
...
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
"Web build completed. Launching IIS..."
Copied template config file 'C:\Program Files (x86)\IIS
Express\AppServer\applicationhost.config' to 'C:\Users\CXSVH9\AppData\Local\Temp\2\iisexpress\applicationhost2018116141435830.config'
Updated configuration file 'C:\Users\CXSVH9\AppData\Local\Temp\2\iisexpress\applicationhost2018116141435830.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:58389/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express
When I fire up localhost, I get the following output in Command Prompt:
Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0
Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0
200's. So, that's good.
But in the browser, I get the message: "Requested view is not available" (a message peculiar to my environment, I'd guess — I just started with this codebase).
Of course, if I start the project from inside Visual Studio, everything works fine. But, as a frontend dev, I'd rather skip that and just fire the project up with a script and use VS Code to edit my static files.
Any thoughts on why this is not loading assets from my web project?
The really frustrating thing is I had this working before, but accidentally deleted my original .bat file and can't get things sussed again.
UPDATE
When I clear cache in the browser, it does GET all my assets with 200's. But still, "Requested view is not available."
Let me somewhat sheepishly answer my own question: I needed to start an additional web service that our website depends upon. This was as simple as writing another batch file to start that web service using the same technique above, but changing the path and the port to their appropriate values.

Sonarqube Error

Sonarqube error in VSTS Build when version 4 of sonar extension is used.
Error -
[SQ] API GET. '/api/server/version' failed, error was:
{"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"} .
SonarQube extension version 3 build runs successfully.
We are using Sonarqube version 7.1
I also faced same error:
[error][SQ] API GET '/api/server/version' failed, error was: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"
To fix this issue:
First I installed Java 17 to devOps build agent machine https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
Java SE Development Kit 17.0.5 Windows x64 Installer.
Installed path: C:\Program Files\Java\jdk-17.0.5
Then add two devOps build pipeline variables:
NODE_EXTRA_CA_CERTS and SONAR_SCANNER_OPTS
SONAR_SCANNER_OPTS:
Copy your cacerts and replace existing one.
path: “…\Java\jdk 17.0.5\lib\security\cacerts”
Then add both paths in devOps SONAR_SCANNER_OPTS variable:
-Djavax.net.ssl.trustStore="C:\program files\Java\jdk 17.0.5\lib\security\cacerts"
-Djavax.net.ssl.keyStore="C:\program files\Java\jdk 17.0.5\lib\security\cacerts"
NODE_EXTRA_CA_CERTS:
copy your cert *.PEM file and replace it the existing one in devops build agent path: C:\devOps_Agent\sonarchain.pem
After this step SonarQube prepare starting to work.

HTTP Error 502.5 - Process Failure - .net core 2.0 to AWS EB

I'm getting this error after deploying my API to AWS Elastic Beanstalk.
Steps to reproduce
File -> New -> Project
ASP.NET Core Web Application
ASP.NET Core 2.0
Web API
F5: OK
Publish to AWS Elastic Beanstalk... (via AWS Tollkit for Visual Studio 2017)
HTTP Error 502.5 - Process Failure
Additional info
Visual Studio 2017
64bit Windows Server 2012 R2 v1.2.0 running IIS 8.5
I've already tried looking up many other questions, but to no success.
Log
2018-01-15T13:27:21.000Z Error 0:(0) IIS AspNetCore Module - Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical root 'C:\inetpub\AspNetCoreWebApps\app\' failed to start process with commandline 'dotnet .\WebApplication2.dll', ErrorCode = '0x80004005 : 8000808c.
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Adding the above code to the .csproj solved the problem.
I faced the same issue. After contacting AWS support, it turns out that there was a bug in my code [Release version].
I suggest the following steps to debug locally:
Publish your solution to a file
Open Command Prompt in the published folder
Run "dotnet Your.Main.App.dll"
Most probably you will see an exception
Sometimes we forget to test our solutions in Release mode.
Cheers!

Resources