How to do bundle update in Wix custom bootstrapper application? - c#

I am trying to make an update of bundle which uses custom bootstrapper application, and I don't undestand how to do it. At fist I tried to set in BA UpdateReplace as a LaunchAction, but it didn't work at all. After reading this, i tried to use Install as LaunchAction.
I am trying to increase Version of bundle, UpgradeCode is fixed. Everything in bundle is fixed, only Version is changed.
Log file of new bundle breaks in two parts. First part detects existing packages and related bundle (old version, operation: MajorUpgrade), plans packages and uninstallation for old bundle. Then first log end by this line:
Applying execute package: {9b21f135-98c9-4126-bd07-2b64c9aaa6f5}, action: Uninstall, path: C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe, arguments: '"C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe" -uninstall -quiet -burn.related.upgrade -burn.ancestors={c641576c-eee6-47c9-bf0c-00c42e8ff5c1} -burn.filehandle.self=984'
The second log file contains this information:
Burn v3.11.1.2318, Windows v10.0 (Build 17763: Service Pack 0), path: C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe
Initializing string variable 'Var1' to value 'false'
Initializing string variable 'Var2' to value 'false'
This bundle is being run by a related bundle as type 'Upgrade'.
Command Line: '"-burn.clean.room=C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe" -burn.filehandle.attached=616 -burn.filehandle.self=632 -uninstall -quiet -burn.related.upgrade -burn.ancestors={c641576c-eee6-47c9-bf0c-00c42e8ff5c1} -burn.filehandle.self=984 -burn.embedded BurnPipe.{6DD039C2-BF8D-4A6E-B96B-3EA4784A1B37} {7B93845A-F588-4A34-97FD-8243D81D5B26} 7948'
Setting string variable 'WixBundleLog' to value 'C:\Users\BALAKI~1.ELE\AppData\Local\Temp\Производственная_система_20200312142440.log'
Setting string variable 'WixBundleManufacturer' to value 'Kirumata'
Loading managed bootstrapper application.
Creating BA thread to run asynchronously.
And nothing else. No exceptions or errors.
In Programs and Features two bundles with different versions are present. So, as I understand, new version was installed, but old one wasn't removed.
The question is: what is going on here and how to make it work?

Okay, finally I have found the way to manage an update.
First of all, we need to create new Bundle with same UpgradeCode but greater version. And we need to start LaunchAction = Install in Bundle bootstrapp application.
Burn will Install new Bundle and after that Uninstall old version. That is the key: method Run() of the custom BA will be restarted, but second start will be in silent mode. So we need to manage installation both by UI and in silent mode. Like this:
if (this.Command.Display == Display.Full)
{
//UX
view.Show();
}
else
{
//Some kind of silent installation
model.PlanAction(this.Command.Action);
model.ApplyAction();
}

Related

Azure Pipelines unable to find .Net framework version 4.0

My solution uses the latest version of .net which is 4.8. However, I see the following error message that complaints about a version 4.0 in Azure Pipelines. Can someone let me know how I could resolve this please ?
The error message indicates I need to install 4.0 but I don't think that's the solution. I also opened up the file Microsoft.Common.CurrentVersion.targets and line 1221 has the following. However, I know it is not advisable to edit this file.
<!-- By default if there is no root path set then the task will assume it is Program Files\Reference Assemblies\Microsoft\Framework-->
<GetReferenceAssemblyPaths
Condition="'$(TargetFrameworkMoniker)' != '' and ('$(_TargetFrameworkDirectories)' == '' or '$(_FullFrameworkReferenceAssemblyPaths)' == '')"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
RootPath="$(TargetFrameworkRootPath)"
TargetFrameworkFallbackSearchPaths="$(TargetFrameworkFallbackSearchPaths)"
BypassFrameworkInstallChecks="$(BypassFrameworkInstallChecks)"
>
<Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_TargetFrameworkDirectories"/>
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
<Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName" Condition="'$(TargetFrameworkMonikerDisplayName)' == ''"/>
</GetReferenceAssemblyPaths>
The error message:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1221,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Note: There are many similar post in SO that suggest to install VS2019. However, I am getting this message while running the application on Azure Pipelines.
Update
From your description, you are using the Microsoft host agent and the pipeline pop out issue 'cannot found NETFramework,Version=v4.0'.
Your environment looks like this:
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#net-framework
or
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#net-framework
You can see that the Microsoft host agent does not have the environment you mentioned.
Although you can install what you need at the beginning of the pipeline startup, I do not recommend this practice. Because when you choose microsoft host agent, every time you start the pipeline, you will be assigned a brand new azure VM machine, which means you need to install the relevant environment every time.
The recommended approach is to use a self-host agent. Please create a self-host agent based on your local machine (or another machine with the relevant environment), the steps are as follows:
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
Provided above are the installation steps of windows self host agent, the steps should be very simple, if you encounter any problems please let me know.
And after that, you can run your pipeline based on that self host agent like this:
pool:
name: <your agent pool name>
If you are using classic pipeline, just click and select:
(If you run successfully on local, then the agent based on local machine should also be no problem.)
And if this is still unable to solve your issue, could you please remove the in-private information and share the YAML file or JSON file, and let me know at which step you encountered this issue?

unable to build xamarin forms 5.0.* locally from sources

Due to some custom reasons, we have some custom built-in features in the XF (like the XAML-based toolbar button and changing private-internal to the public classes, plus virtualizing some methods). As the result, we are dependent on the custom version of the XF NuGet package.
It worked (almost always) perfectly until the version XF5.0. I have a dedicated virtual machine with Windows and preinstalled VS for those purposes.
When I'm trying to build XF from sources using the next command
.\build.ps1 -Target NugetPack -ScriptArgs '--packageVersion="5.0.0.2013"'
I get the error:
Successfully created package 'L:\src_github\xf_patch_release-5.0.0-sr3.1\artifacts\Xamarin.Forms.Maps.WPF.5.0.0.2013.nupkg'.
NuGet Version: 5.9.1.11
Attempting to build package from 'Xamarin.Forms.temp.nuspec'.
Object reference is not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.Packaging.PackageBuilder.<>c.<ValidateReferenceAssemblies>b__173_1(NuGet.Frameworks1204671.NuGetFramework groupFramework)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at NuGet.Packaging.PackageBuilder.ValidateReferenceAssemblies(IEnumerable`1 files, IEnumerable`1 packageAssemblyReferences)
at NuGet.Packaging.PackageBuilder.Save(Stream stream)
at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath, Boolean symbolsPackage)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
An error occurred when executing task '_NuGetPack'.
Error: One or more errors occurred. (NuGet: Process returned an error (exit code 1).)
NuGet: Process returned an error (exit code 1).
I've tried to use different methods to get rid of this non-understandable issue, but nothing happened. I've tried to use the latest actual release-5.0.0-sr3.1 tag and the latest version of the branch 5.0.0
I've tried to change some settings in the build.cake file, to unload some projects from the solution (like UWP-related ones, which usually caused a lot of errors). I've tried to build the solution on my working computer (and environment) - I got the same result.
Then I switched to building the solution in the VS directly and started getting issues like:
Before calling the main task to build: .\build.ps1 -Target NugetPack... I always call the .\build.ps1 -Target provision to ensure that I haven't missed some required tools on each Windows OS.
Is there something that I have missed?
I've found out that I'm using a different version of the NuGet package manager, which I had to install globally on my OS. The right version can be found in the XF's Pipelines (https://dev.azure.com/xamarin/public/_build, see the Windows-related builds).
After I've changed the global version to 5.6.0, the build script started generating the *.nupkg file for the Xamarin.Forms project itself correctly.
...

C# LSP autocompletion client for neovim / vim8

I've tried several ways to make it work but there seems to be no easy way. Yes, there are a ton of plugins, configurations. But they do not work right as per Oct 2019.
OmniSharp-Vim client needs configuration, it covers only C# and it lists plugins integration that does not work anymore (try choosing it for linting in ALE).
YouCompeleteMe should work but it is large and seems bloated.
Deoplete don't have source for C# and configurations I found are out of date.
Coc.nvim does not even list C# and 'unofficial' configurations have issues (like this). Besides Coc.nvim seems to be an alien from VS Code.
LanguageClient-neovim I didn't find sensible configuration and it seems because C# LSP server needs .sln file.
So this seems that csharpers should go to VS (or Rider) and that is when MS proposed LSP. How do you make IDE like from nvim to work with C#?
Basically the client should start server like this and use LSP.
~/.cache/omnisharp-vim/omnisharp-roslyn/run -s <PATH TO SLN OR DIR>
I just got omnisharp / ale working successfully with a clean install. You may want to completely uninstall omnisharp (~\AppData\Local\omnisharp-vim or ~/.omnisharp) just in case you have old versions.
You didn't mention your OS; I have this working in both Windows 10 and Mac OS. If you're using Mac OS make sure you brew install libuv first.
My Environment
Windows 10 (v1903) and Mac OS 10.14.6
Vim 8.1.2244
dotnet core 3.1 - I'd expect 3.0 to work as well
Instructions
First off, I'm using vim-plug as my plugin manager to handle installation. I installed it in both Windows and Mac OS using the bash/powershell snippets in vim-plug's README.
Then I added the following to my vimrc (~\_vimrc on Windows, ~/.vimrc on Mac OS):
"vim-plug config
call plug#begin()
Plug 'OmniSharp/omnisharp-vim'
Plug 'dense-analysis/ale'
call plug#end()
" plugin config
let g:OmniSharp_server_stdio = 1
Restart vim, and run :PlugInstall. It will clone omnisharp and ale for you.
Next, find some C# solution, and ensure the solution builds at the commandline (e.g. dotnet build should complete without errors). You also need a SLN file if you don't already have one (dotnet new sln and then dotnet sln add MyProj.csproj)
Choose a C# file and open it in vim. You should see the following notification:
If the install doesn't autostart, you can start it with :OmniSharpInstall. The install takes a minute or two of downloading in a terminal window. After the installation is complete, reopen vim and execute :cd \path\to\my\solution to ensure the working directory inside vim is correct. Then open a file with e.g. :e MyProj\Program.cs.
The server will be started automatically; don't manually start it. I get a lot of syntax errors for the first few seconds while the server is starting, after that I don't have any errors.
To pull up the autocomplete, type something like Console. then hit Ctrl-x o:
The above screenshot has vim-airline for the bottom bar -- that's not part of omnisharp and isn't required.
The above screenshots are Windows, but it's also working fine in Mac OS:
My full vimrc is available here and the source code I'm testing with is available here.
So far here is my setting for this using Deoplete, OmniSharp and ALE (full config at https://github.com/artkpv/dotfiles/blob/master/.config/nvim/vimrc) :
" Install Deoplete and OmniSharp:
" - OmniSharp/omnisharp-vim " for LSP support (like start OmniSharp server) and code actions, etc
" - Shougo/deoplete.nvim " for better autocompletion
" - dense-analysis/ale " for highlights
function SetCSSettings()
" Use deoplete.
call deoplete#enable()
" Use smartcase.
call deoplete#custom#option('smart_case', v:true)
" Use OmniSharp-vim omnifunc
call deoplete#custom#source('omni', 'functions', { 'cs': 'OmniSharp#Complete' })
" Set how Deoplete filters omnifunc output.
call deoplete#custom#var('omni', 'input_patterns', {
\ 'cs': '[^. *\t]\.\w*',
\})
" ... then goes your mappings for :OmniSharp* functions, see its doc
endfunction
augroup csharp_commands
autocmd!
" Use smartcase.
" call deoplete#custom#option('smart_case', v:true)
autocmd FileType cs call SetCSSettings()
augroup END

SSIS Package failing because "script task is failing because the script is not precompiled"

I developed a pretty straight forward SSIS package (in VS2005 w/ .Net Framework V 2.0.50727 SP2) that gets a list of users to email, starts a for-each loop container and then executes a script task to retrieve user specific data and email it out to the user. When I run it on my dev box everything works great and runs as it should. However when I deploy the package to our production server running (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2) ) the task fails.
The original error message is:
Executed as user: xxxxx. Microsoft (R) SQL Server Execute Package Utility Version 9.00.5000.00 for 64-bit Code: 0x00000009 Source: PackageName Description: The task cannot execute in 64-bit environment because the script is not pre-compiled. Please turn on the option to pre-compile the script in the task editor. End Error ... Error DTExec: The package execution returned DTSER_FAILURE (1).
After researching that extensively the interwebs suggested that I try:
running the package in 32bit by changing the execution property in the SQL job and by changing my RunIn64BitMode property from true to false
which fails because " Option "/X86" is not valid."
install the Microsoft Hotfix
which doesn't apply since I am already running on SP2
So after more research I find that I need to turn on "Please turn on the option to pre-compile the script in the task editor." SOURCE: ssis-dtsx DOT blogspot DOT com/2010/03/cannot-execute-in-64-bit-environment.html
Which entails:
Make sure that each script task has PreCompile = True
Open Script Task Editor, switch to Script tab and make sure that
PrecompileScriptIntoBinaryCode = True
Click on Design Script to open code editor (Visual Studio for Applications) and then choose it using File > Close and Return (VSA will recompile and store binary code in the package).
Build Project and copy to target location
However when I execute the package I immediately get the error:
Executed as user: xxxx. ...0.5000.00 for 64-bit Code: 0x00000008 Source: PackageName Description: The task is configured to pre-compile the script, but binary code is not found. Please visit the IDE in Script Task Editor by clicking Design Script button to cause binary code to be generated. End Error Code: 0x00000008 Source: GET PO infor and Email Description: Script could not be recompiled or run: Retrieving the COM class factory for component with CLSID...
So my final step was to turn DelayValidation property from False to True in the SSIS pkg, go into the design script to cause it to be rebuilt, then redeploy, and rerun and I still get the same error.
On searching the error I am directed to Microsoft HOT FIX which suggested that I download another hotfix.
I have not yet downloaded the hotfix, and would prefer not to if I can avoid it (our OPs team doesnt like running hotfixes mid day on production servers).
Go to the package, open the script component, then within Visual Studio (while looking at the code) click on BUILD. This will compile the package, if there are no issues preventing it from compiling. Then SAVE, go back and ensure that you click on "OKAY" and not "cancel", if you click on cancel then the whole thing reverts back.

Python.NET - Name must not be empty

I'm embedding some Python code in C#/.NET and it breaks on this line in Python.NET during import:
public ModuleObject(string name): base() {
if (name==String.Empty)
{
throw new ArgumentException("Name must not be empty!")
}
...
How is it possible that some imported Python module is empty string???
So far this is not reproducible on other machine.
I'm using this branch (locally compiled):
https://github.com/renshawbay/pythonnet
This issue may be caused by relative imports. It appears that this has been patched. For me a fix involved upgrading from pythonnet-2.1.0 to pythonnet-2.2.2
pip install pythonnet --upgrade
References
https://github.com/matthid/pythonnet/commit/28239416e4d30edc0ddd24e77e4181b1c4646c3b
https://github.com/pythonnet/pythonnet/pull/182#issuecomment-222008972
Seaborn 0.5.1 is not correctly installed/uninstalled using Anaconda on Windows 7, 64bit, Python 2.7.
'conda remove seaborn' leaves some seaborn files in site-packages.
EDIT
I just realised why this happened - another process blocked complete uninstallation of seaborn package. this is both for conda and pip. so probably has nothing to do with seaborn or conda.

Categories

Resources