I am trying to connect to SVN via Visual Studio 2019 and the .NET 5 framework. My requirement is to get the list of repos under SVN. I am able to move the repo from one SVN repo to other, then upload the code to SVN.
All the mentioned items have to be done with C# code.
What I have tried:
I tried using Visual SVN/Sharp SVN, but it's not compatible with the latest VS 2019 + .NET 5 Framework.
This is the code I'm using to try to connect to client with Sharp SVN:
var client = new SvnClient();
client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true);
try
{
client.Authentication.SslServerTrustHandlers += delegate (object sender, SvnSslServerTrustEventArgs e)
{
e.Cancel = false;
};
SvnLogArgs args = new SvnLogArgs(new SvnRevisionRange(500, new SvnRevision(SvnRevisionType.Head)));
System.Collections.ObjectModel.Collection<SvnLogEventArgs> revisions;
client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);
client.GetLog(new Uri(uri), args, out revisions);
foreach (var item in revisions)
{
}
I'm getting the following error:
System.BadImageFormatException: 'Could not load file or assembly 'SharpSvn, Version=1.6003.1304.38397, Culture=neutral, PublicKeyToken=d729672594885a28'. An attempt was made to load a program with an incorrect format.'