I did create a single file application with C#. I have this executable located in a repository and I push it as an artifact. The former is used in build pipelines where I simply add the repo so I can use it. The latter is to use it as an artifact for a release pipeline.
Now during a build pipeline I can simply use it, have tested it and it works. Not really important but the application does 2 things, it sends out mails and updates work items.
When using that exact same application in a release pipeline I get the following error:
Failure extracting contents of the application bundle.
I/O failure when writing extracted files.
I don't know for sure, but could this have something to do with the release pipeline's agent running in a containerized environment? The reason I am asking so is because someone else had such an issue while using this approach on AWS with containers, see this Reddit link
[UPDATE]
The release pipeline was running on a self-hosted Azure DevOps agent. The environment where it is installed on has no .NET 5 runtime nor SDK installed. But I expect the single file application to contain the runtime as well, or am I wrong?
I did publish my application as a simple folder publish. Then putting all the files within the publish folder in the Azure DevOps repository.
Next I pushed all those files as an artifact with a build pipeline, had to install the .NET 5 current runtime on the environment as the release pipeline is running on a self-hosted agent, and then I am able to run the application.
Related
I've been trying to automate updating the runtime version of already existing Azure App Services. Currently I have around 20 running App Services (Windows), each on the same runtime stack (let's say .NET 5). I would like to manage versions and upgrade to .NET 6 (and later to .NET 7 etc.) with minimum manual work required. The current flow of the process looks like that:
Code is being merged with master in Pull Request;
Build Pipeline is triggered, runs project with tests, publishes artifact with the newest build (I've already updated it to use .NET 6, my project is configured for .NET 6 as well).
Release Pipeline is triggered, because new Artifact is published;
This pipeline has 20 stages, one for each app service - it deploys the code artifact using Azure App Service deploy task.
I would like to update all these app services without me going into azure portal -> app service configuration and changing the runtime manually. I don't really know what is the best place to put "something" that updates the runtime automatically/after changing some single parameter by myself to indicate that it should now update all these App Services to .NET 6.
What I've considered:
Run some inline azure cli script at the beginning of Release Pipeline (I believe there is an agent task for it) that updates the runtime stack of each app service to desired version - but I haven't found a way to achieve it via Azure Cli (the azure cli equivalent of going to azure portal -> app service config -> changing runtime). Did I miss something? Is it the right approach?
Make some Powershell Script that gets invoked somewhere in the flow that bumps runtime to desired version provided in parameter;
I've considered that there possibly is some nicer way to control the runtime version of already running App Services, but I cannot find any.
Could you guys guide me towards the correct approach? Thanks in advance, if any additional info is required I will, of course, provide it.
A solution consists of...:
Web app
Console app ("jobserver", which pulls jobs and processes them)
All is C#, .Net Core 5.
I have continuous deployment set up, so new versions of the web app are deployed to Azure Web App automatically.
However, the console app, I cannot figure out a good way to deploy to a Windows server (or pull). Right now, I go to the server, stop the app if it is not doing anything (otherwise I wait a bit). Then I copy the files over and start it up again. All manually.
I can think of several complicated workarounds, but I am thinking there must be easier way.
What are some ways the deployment of exe file could be handled? How are others handling this?
Ps. The console app cannot run on Azure Web App or as WebJob or similar, because it has requirements that means it has to run on a "real" windows server.
You can use the PowerShell on Target machines or SSH tasks to run commands on a remote machine. Similarly, to copy files, you can use Windows Machine File Copy or Copy Files Over SSH to copy your .exe to the server.
I have created a new Blazor WebAssembly project and made it ASP.NET Core hosted (so, Visual Studio created three projects, one for the server, the actual WebAssembly client project, as well as a class library holding types used by both apps). Then, I just followed the documentation at https://github.com/ElectronNET/Electron.NET to electronize the server app. In theory, everything should be fine.
Problems occur when I try to run the app via electronize start. The build fails with the following error.
...Microsoft.NET.ILLink.targets(143,5): error NETSDK1102: Optimizing assemblies for size is not supported for the select
ed publish configuration. Please ensure that you are publishing a self-contained app. ...
Error occurred during dotnet publish: 1
Of course, I can imagine what the actual problem is. The Electron build tries to publish the assemblies for the current target platform, which is x64 in my case, but this is not supported for blazor-wasm projects. What I basically want to achieve is that the client build output gets included with the electronized server app.
Update
The following command successfully builds the electronized app, if the PublishSingleFile and PublishReadyToRun properties are set to false. Though, this is far from optimal since it creates an app that comes with a performance penalty (increased load time).
electronize build /target win /PublishSingleFile false /PublishReadyToRun false
Sadly, the switches currently do not work with the electronize start command.
My company has recently switched from automatic migrations on our Entity Framework databases to now relying on a command being run to migrate and afterwards seed the database.
We want this to run on the database of each environment that is being deployed to via Appveyor, so when pushing to a specified branch Appveyor builds, deploys and then runs the migrate and seed command on each environment after the deploy is completed.
We usually place all build and deploy configuration in a yaml file, but there doesn't seem to be any way to run commands after deploy on the environment itself. The yaml script command after_deploy runs command as part of the build process, not the environment.
The Appveyor environment has a setting After deployment command that seems to be the key, but it requires the "runCommand" provider to be allowed on the server side. The reason for this is understandable, but how do I go about setting this up?
The guides I've found haven't really given anything. Nothing applicable on SO, and the link to Microsoft that Appveyor prints as an error in the deploy process is no longer accurate.
Because environment deployments run on shared worker severs, custom scripting is not allowed. But you could try a deployment project approach. This divides your project into a "main project" and "deploymnet project" thus simulating a deployment environment, allowing you to decouple builds and deployments.
Assuming you are deploying to azure, you could then use this script my colleague wrote to run your commands on the server.
If you are not deploying to azure, you could switch to AppVeyor deployment agent which uses web deploy behind the scenes.
I am completely new to Azure and PowerShell but have been tasked with setting up a build and deploy solution for several app services.
We currently have a build server (Azure VM) that is running CruiseControl.NET to build and test some C# .NET solutions that should be deployed in Azure.
This build server currently handles the following tasks:
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
However, as it exists now, developers of each of our app services need to 'Publish' their services manually from their development machines by clicking the button in Visual Studio once they have verified that the build and test cases have passed in the test environment on the server.
As I am hoping for a completely automated solution, I expect I need to use something like PowerShell or the Azure Cross Platform CLI (npm) to do this?
I'm extremely confused with the Azure Service Management vs Azure Resource Management versions with the new Azure Powershell 1.0. All of our services appear to be the newer Resource Management versions, not 'classic'.
The eventual goal is to have the build server do the following
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
If the build and test cases are successful, update the service in azure to the latest build
I am hoping there is a way to set up these projects, or take the existing binaries that result from the builds, and have them be deployed into Web Apps using the new Azure Resource Management Powershell features.
Any advice or resources for more information about how this can be done?
Hopefully this makes some sense. Please let me know if I am going about this completely the wrong way or direct me to a more correct forum.
Thanks!
have you consider to use Azure App Service? where you can get those build infrastructure for free. e.g https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
Once you setup continues deployment, you will get below three when there is push event (if you are using git)
Pulling code from source control when commits happen
Building the projects
Copying output/binaries to an output location
and to "Running some unit test cases", you can create your own batch or powershell script with post deployment hook https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks