Creating an MSI installer for a C# SCD Deployment (Visual Studio 2019) - .net-core

I have a .Net Core 3.1 application that I'd like to deploy as a Self Contained (SCD) Deployment using an MSI Installer in Visual Studio 2019...
I have published the project as an SCD Deployment and I can run this on the target machine just fine
However, I've been asked by IT support to provide an MSI installer for the application as .MSI files work well with some of the admin/control applications they have.
So I created a setup project in my solution and selected 'Publish Items' as the Project Output of the setup project and rebuilt it...
The installer seems to run just fine on the target machine but when we try to run the installed application it says that .Net Core is required ...It's as if the installer has ignored the Self Contained aspect and just installed as a regular Framework Dependent Deployment
Is there a way to create an installer that installs an SCD deployment? Have I made a mistake in my thinking?
Many Thanks in advance,
Andy

The VS Setup Project template is quite old. Most likely it was not updated to be "aware" of the SCD support so it resorts to extracting the classic output binaries from your project.
There are other free tools that you can use to create an MSI from VS, which give you more options to customize and correctly configure the package.
If you have time and want to learn a new skill, try WiX Toolset. It is very powerful but you will need some time to get started.
If you wanted to get it done quickly and avoid the hassle, use the free VS Extension from Advanced Installer. Its GUI allows you to easily create your setup package and it has native support for .NET Core packaging too. If you follow the steps from the linked tutorial it should create a working package for your application.
Disclaimer: I work on the team building Advanced Installer.

Related

Building MSI in azure devops

We have for a while been building various web projects with AzureDevops and self hosted build agents.
Today I had to add a new build, consisting of a windows service written in .net core 3.1. This service has to be installed by our customers, so we have to provide it in a friendly installable way. As some of our developers were already used to handle MSI/*.vdproj projects, they added a vdproj into the *.sln to manage that. On a developper machine, this is not a problem even with VS2019: you just have to use the relevant VS studio extension...
But when it comes to building that in a CI/CD context, this becomes a real challenge. I quickly understood that we can't use MSBuild at all for that and found some alternative using directly Visual Studio (devenv)... Inspired by this thread (still opened), I came up with the following command line:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv" [...]\MySolution.sln /build "Release" /Project MyInstallationProject
This worked fine both on my developer machine and even on the build agent machine. But when I add it into a build pipeline as a command line task, it seems to hang, and after a while I get the following result for the job:
##[error]The job running on agent <MyAgent> ran longer than the maximum time of 60 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
What can I do to make it work?
What are the best practices for generating a self installable in a CI/CD context? (Is MSI still relevant? )
As a workaround, you can try to install the extension Build VS Installer and use the task DutchWorkz - Build VS Installer(s) to build Visual Studio Installer Project in Azure Pipelines.
Here are some tickets(ticket1, ticket2) with similar issue you can refer to.

How can we bundle and install lower version of dotnet core using Wix Sharp?

We developed our application and tested over DotNet core 3.1.101 and it was working fine but what happened is Microsoft updated dotnet core to 3.1.111 and it breaks our application and we are asking customer to downgrade the core version manually that doesn't seem to be good idea.
Can somebody Wixsharp/.Net expert suggest, how can we avoid this problem? Can we have side by side installation of dotnet core and use the desired on with our application? If yes, How can we do it?
If you are really dependent of the specific net core version, the best solution to you will be to use self-containing publishing (https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained). This will create the solid bundle from your code and the your current net core version. On the client machine your app will use the net core, which is bundled with app. User may have other versions of net framework/net core installed, but these versions will not affect your app in any way.
For example, the following will create 64-bit executable for Windows
dotnet publish -r win-x64.
After you got your bundle from publish command, you need just pack the whole bundle with wix as usual. Not need to perform additional steps to install net core.

Packaging a Qt/win32 application to post on microsoft store

I have a medium sized C/C++ Qt application that uses some win32 API functions. I compiled for release and created a directory that contains all the needed DLLs and resources files needed. I tested it on other machines and it works fine.
Now my question is.. how to package such application so that I can put it on microsoft store? Note that it is not a UWP app and it uses some functions from win32.
You can use the Professional edition of Advanced Installer (it has Visual Studio integration) and create an MSIX package ready for the Windows Store.
Here is an article that takes you through the MS Store publishing steps
Also, an article that explains how to build and MSIX package using Advanced Installer's VS extension
Disclaimer. I work on the team building Advanced Installer.

Configuring existing ASP.NET project for DNVM, DNX environment on a Mac

I have an ASP.NET Web API project created on Windows using Visual Studio. How can I set this up for use with DNX/DNVM (on a Mac)?
Switching to Git solved the source control compatibility with TFS. But I wasn't able to find references to getting a project working across both these development environments.
I'm assuming as a first step the project will have to be migrated to ASP.NET 5/vNext but wondering other problems lurk around the corner with different project members using different environments.
I get an error when I run - git:(master):dnx . kestrel
As you mentioned yes you will have to migrate any namespace changes. I have a project that is developed across both. Also changing csproj files to xproj. Support is coming for some kind of interop between the different project types but its not here yet.
For build, publish, deploy from git without relying on VS publish capabilities or MSBuild you can follow my blog post here.
Basically you use DNU to publish and then kudu to deploy.

Automating MSI Build Process

Does anyone have a good way to build MSI (vdproj) projects using MsBuild or Nant?
I know one answer was to install Visual Studio on the build server and just use devenv.exe to build the project, but, I prefer not to install Visual Studio on our build servers.
Short of the method you mentioned above (devenv), there is no way to do this with the current version of MSBuild.
The method the Visual Studio team uses to run their MSI builds is with Windows Installer XML. You can learn more about using WiX to deploy setup packages here.
Please note WiX doesn't support vdproj files so it means you'll be recreating your installer projects.
Edit: Looks like I was beat to the chase when grabbing my references :)
We use Wix to automate MSI builds for IronPython and IronRuby.
EDIT: to clarify, this probably means starting over from scratch when building your installer. While Wix has a mechanism to create a configuration directly from a preexisting MSI file, I've never gotten a satisfactory result from using this tool

Resources