Building Duplicati in Visual Studio 2012 on Windows 7

OK - so I:

  1. downloaded duplicati-master.zip from github
  2. unzipped it
  3. opened the Duplicati.sln file in Visual Studio 2012
  4. went to Build -> Rebuild Solution (in Debug)

And got 369 errors starting with two dozen NuGet related errors such as:

Error 1 NuGet Package restore failed for project Duplicati.Library.Main: ‘Newtonsoft.Json’ already has a dependency defined for ‘Microsoft.CSharp’… 0 0

Error 2 NuGet Package restore failed for project Duplicati.Library.Compression: ‘SharpCompress’ already has a dependency defined for ‘NETStandard.Library’… 0 0

Error 4 NuGet Package restore failed for project Duplicati.Library.Modules.Builtin: The ‘MailKit 1.16.1’ package requires NuGet client version ‘2.12’ or above, but the current NuGet version is ‘2.8.60318.667’… 0 0

Ummm, OK - that last one tells me something. Off to do an update and try again…

Well OK then. Apparently NuGet Package Manager 2.12.0 requires Visual Studio 2013 meaning my VS 2012 is stuck at v2.8.60318.667.

So…any suggestions on non Visual Studio environments known to work with Duplicati? :slight_smile:

I use VS 2015 community edition, and have not had issues.

I think you can just install nuget and then use nuget from the commandline, something like:

nuget.exe restore Duplicati.sln

I can’t move beyond VS 2013 on this machine due to other coding issues however I’ve got a a few spare machines & VMs floating around that I should be able to work with.

Out of curiosity, do we know if anything other than VS Full or Community has been / can be used to work on Duplicati?

I use “Visual Studio for Mac” daily, and it works fine with Duplicati, but is not a port of “Visual Studio” it is a rebranded version of MonoDevelop (formerly Xamarin Studio).
Also, “Visual Studio Code” and “Visual Studio” are two very different programs (VS Code is basically an editor, with some plugin support).
Really poor choice for names!

You can still use MonoDevelop on Linux, and Duplicati works with that as well (last I checked on Ubuntu 16.04).

Last I tried, it was possible to have multiple versions of VS installed on Windows.

Thanks - I had forgotten about Xamarin.

I’ve done multiple VS installs before and ran into issues with certain combinations.

Oooo - evil Microsoft. Made me think I was registering for and downloading Xamarin only to give me the cs_community.exe installer. Boo!

Hello MonoDevelop!
http://www.monodevelop.com/download/

For the record, I tried using MonoDevelop (aka Xamarin Studio) on a “developer fresh” Windows 10 box and eventually gave up (see below). VS Community 2017 worked fine.

All told, to go from a non-development box to something that can build Dupilcati took about 90 min and ~4G of disk space.

1. Download and install MonoDevelop (aka Xamarin Studio) from http://www.monodevelop.com/download/
2. If prompted about "Gtk# version 2.12.22 or greater must be installed." during install check out http://www.mono-project.com/download/#download-win
3. If prompted about "Xamarin Studio 6 requires MSBuild tools 2013 to be installed." see https://www.microsoft.com/en-us/download/details.aspx?id=40760
4. If prompted about "Xamarin Studio 6 requires MSBuild tools 2015 to be installed." see https://www.microsoft.com/en-us/download/details.aspx?id=48159
(Yes, you need BOTH MSBuil tools 2013 AND 2015.)
5. Do a PR (Pull Request) if planning to submit updates (or just just download the zip file if you simply want to poke around) from GitHub @ https://github.com/duplicati/duplicati
6. Open the Duplicati.sln file in Xamarin
7. Try "Build -> Rebuild All" before doing anything else (so you know you're starting in a working state)
8. Get a bunch of errors about expecting semicolons in what appears to be perfectly good code
9. Give up and install Visual Studio Community edition from https://www.visualstudio.com/vs/community/
10. Open Duplicati.svn and install whatever "missing features" (such as .NET Desktop Development) VS tells me I need.
11. Try "Build -> Rebuild Solution" and watch the magic happen!
1 Like

For those keeping score, even after successfully installing and building with VS 2017 Community Edition, both SharpDevelop v4.4.1 and Xamarin Studio Community v6.3 fail to build for me with 10 errors related to “;” being expected or being an invalid token in a class, struct, or interface member declaration.

Usually this happens when it cannot load the right version of the .Net framework. Duplicati needs .Net 4.5, so maybe there is a problem with those not being able to load .Net 4.5 ?

I tried installing the .NET Framework 4.5.1 Developer Pack in the hopes that I could get SharpDevelop 4.4.1 working, but it doesn’t seem to have solved my problem.

My initial question is, has anybody else been able to built Duplicati 2 with SharpDevelop 4.4.1?

Edit: I’ve figured out the first problem - there are 10 declarations in Utilities that have been written with C# 6 lambda style Expression-bodied function members and apparently SharpDevelop 4.4.1 doesn’t support C# 6. Re-writing them as traditional GET declarations removed those errors.

Now I’m running into the following, which seems to be related to the Duplicati.Library.Utility.csproj file having Prefer32Bit set to True (and is the ONLY project to have this as True for some reason).

Edit 2: It looks like either my checkout or SharpDevelop is screwing up line formats as I’m getting entire classes appearing on a single line. Some include comments, thus breaking the rest of the line. I’m going to try checking out again and see if I can figure out from where the reformatting is coming.

/platform:anycpu32bitpreferred is not a valid setting for option /target:library or /target:module (CS4023)
Old whining, left here for searchability only

At the core level that problem is I that I know just enough to be dangerous. For example, I expect this is trying to declare a variable and set it’s default value in a single command, but I’ve never actually run into doing that in C# before outside of a Linq statement.

public static TimeSpan OperationTimeout => CallContextSettings<HttpSettings>.Settings.OperationTimeout;

So when trying to build the project with SD I get 5 errors related to this code structure.

Invalid token ';' in class, struct, or interface member declaration (CS1519) - C:\duplicati-master\Duplicati\Library\Utility\CallContextSettings.cs:134,111

; expected (CS1002) - C:\duplicati-master\Duplicati\Library\Utility\CallContextSettings.cs:134,49

My followup question is, if you HAVE gotten it to build - do you have any suggestions for what I need to do to get it working on my system? :slight_smile:

That is probably some linefeed issue. I try to keep the sourcecode with Windows line endings, but Xamarin studio occasionally “forgets” this setting, causing messed up checkins from me. Most tools show the files fine, so it is a bit of a hassle to fix/prevent.

Not sure why that would be, but no projects should have that set to true, as it makes Duplicati run 32bit mode, even on x64. Setting it explicitly to false makes it run whatever the OS/CPU is using:

Looking at a fresh checkout with a text editor shows neither the linefeed issue nor the prefer32bit=true setting, so I (or my IDE) must have somehow caused those to happen.

Ugh - I really WANT to use SharpDevelop, but they make it so…darn…hard!

I’ve switched back to VS Community Edition 2017, made my stupid period update and attempted to push the changes into Git - with some minor process mistakes.

So I pushed my changes to my master (GitHub - JonMikelV/duplicati: Store securely encrypted backups in the cloud!) rather than my targeted branch (https://github.com/JonMikelV/duplicati/tree/feature/add_missing_ui_period).

Does that matter and if not, what’s the process to ask you for a pull request (is that the right way to say it)?

(And thanks SO MUCH for all the hand-holding here!)

It does not really matter if you are only working on one thing at a time. You can submit a pull request directly from the Github page:

On the next page you can choose which branch to merge into (master) and from which branch on your side (master as well).

Sorry for hijacking but I think it is the same topic …

I tried to build and debug Duplicati on Windows 7 but I get an error with my Microsoft “VS Express 2013 for Desktop”.

public static long DEFAULT_BUFFER_SIZE => SystemContextSettings.Buffersize;

The => is not known. Is there something in Visual Studio to change the language level?
It it possible to use VS 2013 Express?
Sorry for this question but I am a Java-Guy and know the C# tools not so detailed.

If not I would install MS Visual Studio 2017 Community Edition. What do I need?

Is it ok to chose this one or do need anything more?

.NET desktop development
Build WPF, Windows Forms, and console applications using C#, Visual Basic, and F#.

A full installation of everything would be about 40GB and that’s too much.

I couldn’t use my existing VS 2013 (full edition) due to the NuGet package manager version constraints.

While Kenkendk says he’s used “VS 2015 Community Edition” I went straight to “Visual Studio Community 2017” (specifically Microsoft Visual C# 2017) and had no problems building the raw cloned version.

What do you mean by that too much local storage? I’m a newbie myself so may have install WAY more than I needed to but once all the VS 2017 CU install was done my C:\Program Files (x86)\Microsoft Visual Studio folder ended up being 1.22GB (and 0.9GB of that is in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7).

Totally jumping back to this. Whenever this happens, just pull out your git terminal and fix it with a couple of commands :slight_smile:
Write the commit hashes down somewhere (important!) and make sure you have your upstream remote branch defined
git remote add upstream https://github.com/duplicati/duplicati/
Then reset the branch (basically remove the connection between the commits and the branch)
git reset --hard upstream/master
push the changes and override the master you accidentally pushed to
git push origin master --force
Then you can checkout the correct branch and cherry-pick the commits you already made on master
git checkout add_missing_ui_period
git cherry-pick abeab474
If you have multiple commits, just cherry-pick each one. Then push it to github.

The commits never disappear, even if you reset your branches, so as long as you write down all the hashes before doing a reset you can always apply your commits on any branch later.

And as you may already know, it’s important to not do pull requests from the master branch if you want to do multiple pull requests. This is because any changes added to the branch will be added to the pull request until the pull request is merged :slight_smile:

1 Like

Thanks for the tips!

Yeah, I’m starting to get that. I came from a Subversion background so have the wrong mindset for git. But I’m learning…slowly going through an actual “how to use git” only tutorial. (Haven’t even heard of cherry-pick until now.) :slight_smile:

It didn’t help that I was trying to avoid the CLI thinking the GUI was the “right” way to do things. :blush:

Cherry-pick and resetting against upstream is amazing. I use it often now but I didn’t start using it properly until last year when I realized how easy it is :slight_smile:

I like to keep a GUI around too. Since it makes it easier to get an overview. But currently I mostly rely on the GitHub web UI for that so it’s identical on all platforms I use.