Reputation:
I have been developing a .NET 5 console application which downloads and uploads files and folders from/to my Windows server and Dropbox. (As a side note, I plan to upgrade to .NET 6 once this is released this November).
So far everything is working well, but rather than poll, i.e. download files from Dropbox at a set interval, it would be far more efficient to use Dropbox webhooks and download changes upon notifications of changes from Dropbox.
When looking into Dropbox webhooks under .NET, I quickly discovered that there is no .NET 5 version of a Dropbox webhooks NuGet package. The only NuGet package that is available for my Visual Studio project to install is the Microsoft.AspNet.WebHooks.Receivers.Dropbox (version 1.2.2). Unfortunately this NuGet package is for .NET Framework 4.x projects.
Microsoft ASP.NET WebHooks
Here are the related warnings related to incompatibility once this NuGet package was installed:
Warning NU1701 Package 'Microsoft.AspNet.WebApi.Client 5.2.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
Warning NU1701 Package 'Microsoft.AspNet.WebApi.Core 5.2.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
Warning NU1701 Package 'Microsoft.AspNet.WebHooks.Common 1.2.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
Warning NU1701 Package 'Microsoft.AspNet.WebHooks.Receivers 1.2.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
Warning NU1701 Package 'Microsoft.AspNet.WebHooks.Receivers.Dropbox 1.2.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
I suspect this .NET 4.x Framework NuGet package may actually work under .NET 5, but I haven't tried it yet. But I don't like the fact that my project would include the entire .NET 4.x Framework files alongside the required .NET 5 files.
Question: What are others doing to get webhooks to work under .NET 5 or .NET 6?
I'd be happy to use other technologies to get webhooks working under .NET 5, e.g. using Javascript/nodeJS, if this is an valid option for a console app.
Perhaps I should have used .NET Core 3.1 as it is an LTS release, and it does contain a supported Dropbox webhooks NuGet package under .NET Core, Microsoft ASP.NET Core WebHooks. But I've put in alot of time and engery into .NET 5 already. Help!
Upvotes: 2
Views: 709
Reputation:
Ok to help others out there, I managed to code this using a .NET Core 5 Web API app project with straightforwards GET and POST methods...
[HttpGet]
public ActionResult Get(string challenge)
{
return Content(challenge);
}
[HttpPost]
public async Task <ActionResult> Post()
{
.....
.....
}
Thanks for the push in the right direction manson.
Upvotes: 0