Building Duplicati with VS fails

I cannot get that branch to compile somehow – I use VisualStudio 2017 Community Edition and use the ‘Duplicati’ solution and a full clean+build, but i get this error in the debug build:

'Duplicati.CommandLine.exe' (CLR v4.0.30319: UpdateDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Duplicati.CommandLine.exe' (CLR v4.0.30319: UpdateDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Duplicati.CommandLine.exe' (CLR v4.0.30319: UpdateDomain): Loaded 'C:\Users\maarten\Source\Repos\duplicati\Duplicati\CommandLine\bin\Debug\Duplicati.Library.Snapshots.exe'. Symbols loaded.
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in SQLiteHelper.dll
Exception thrown: 'System.IO.FileNotFoundException' in CoCoL.dll
Exception thrown: 'System.IO.FileNotFoundException' in Duplicati.Library.Main.dll
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
The thread 0x31fc has exited with code 0 (0x0).
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
The thread 0x3a44 has exited with code 0 (0x0).
'Duplicati.CommandLine.exe' (CLR v4.0.30319: Domain 2): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'Duplicati.CommandLine.exe' (CLR v4.0.30319: UpdateDomain): Unloaded 'C:\Users\maarten\Source\Repos\duplicati\Duplicati\CommandLine\bin\Debug\Duplicati.CommandLine.exe'

A quick stab without trying myself: can you do Nuget restore perhaps?

Should this get forked over to Developer until a solution to the OP is found?

Please note, it has been at least 10 years since I did something with C#, so i’m no expert at all.

I tried the Nuget restore in Visual Studio but it tells me everything is fine. One thing I did notice is that when I use the general ‘Duplicati’ solution, but build the ‘Duplicati.Commandline’ project, I need to manually add the Snapshot and another dependency because it will not build otherwise.

That’s odd - on a fresh (non-development) machine I installed VS 2017 CE and was able to build the zipped version of duplicati-master without having to do anything else (no Nuget updates, etc.).

Edit: I tried a fresh unzipping and I do see that on a Rebuild Solution it is doing a Restoring NuGet packages... To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.' - but the resulting Debug Duplicati.GUI.TrayIcon.exe runs just fine.

I have not used that for a while, it was a workaround where I limit the number of project dependencies due to a performance issue in VS for Mac. In other words: it may be broken.

Do you see the files mentioned as missing: CoCoL.dll and SQLiteHelper.dll in the bin\Debug folder?

I am not sure what is happening really. First time i had no issues at all building the solution and I only needed to add one or two references to the project for the CommandLine. I then tried the different branch as suggetsed, but since then I just cannot get a working build anymore which is frustrating to be honest :frowning:

I already tried deleting the whole repo directory and doing a new checkout from Github for the master branch but I get the same errors. Because it complains about a bad image exception in some core libraries I’m beginning to think theres something wrong with the Visual Studio installation or something.

Wow, I have not seen that at any point. If you remove the folder, and do a clean git checkout, there should be absolutely no traces of the previous Duplicati (it never writes anything outside the project directory).

Shot in the dark here, but there wouldn’t be the potential for an issue with the GAC (Global Assembly Cache) not getting cleaned up would there?

Not sure how VS does it, but Duplicati does not install stuff in the GAC. It is possible that the .Net assembly loader finds stuff in the GAC that causes the problems.

My (limited) experience with the GAC is that while you CAN specifically install things to it, it also works like a “normal” cache and is populated (and updated if necessary) automatically / as needed by .NET at run time.

That being said, I checked mine (service install) and didn’t see anything obviously Duplicati related, but I didn’t dig too deeply yet either.
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe" -l