C# program deployment issues - c#

I want to deploy my C# program, but I'm having issues with running it on another computer.
I copied the entire folder from bin/debug to another computer and tried running the program. I receive the following error message:
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I thought it might be the issue of the computer not having .NET Framework 4.5.2 and tried downloading the installer from Microsoft but the installer states .NET
Framework 4.5.2 or a later update is already installed on this computer.

This assembly it's not distributed with .Net Framework 4.5 you'll need to add to you project by NuGet, search online in NuGet package manager for Microsoft.Tpl.Dataflow.

I got an same problem and my problem was a missing project reference after an update of an dependent package.
I had to reinstall my nuget packages with the command Update-Package –reinstall in the Package Manager Console.
https://learn.microsoft.com/en-us/nuget/consume-packages/reinstalling-and-updating-packages
After that the project references was newly added.

Related

FluentFTP has old dependency to Microsoft.Extensions.Logging.Abstractions

Currently I am developing a azure function. I use Net6.0. I have multiple imports. At least one with ftp and one with http.
So I imported both packages via nuget. But if I start my function, the following error occurs:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Http, Version=7.0.0.0, Culture=neutral, PublicKeyToken=...'. The system cannot find the file specified.'`
This error is thrown because of a dependency of FluentFTP:
If I downgrade Microsoft.Extensions.Http to Version 6.0.0. The application starts without any error. Or, if I remove the Microsoft.Extensions.Http package, it also works (then the depency has version 2.2.0).
But why is this a problem with the newest version? Is there a way of using all packages with the newest version?
You are targeting net6.0 and the Microsoft.Extensions.Http dependency you are trying to install is meant for net7.0.
You can check that versions are named according to the .net version - https://www.nuget.org/packages/Microsoft.Extensions.Http/7.0.0#versions-body-tab
That is why you should use Microsoft.Extensions.Http version 6.0.0 or below.

Could not load file or assembly 'Microsoft.Data.SqlClient' in .NET 6

I have developed a WPF app on .NET 5 (CRUD operations with Entity Framework Core). MSI packages are built with Wix toolset. Up to here everything works.
I am currently trying to convert the app to .NET 6. Everything runs perfectly, the Nuget packages can all be updated, building the MSI packages also works.
After installation on the client PC, the following message appears and the app crashes:
Could not load file or assembly "Microsoft.Data.SqlClient, Version=2.0.20168.4, Culture=neutral, ..." The system cannot find the file specified.
Thanks for any help or ideas...

Errors when using Sqlite in UWP

I am using Visual Studio 16.8. and I am trying to make an UWP application working with EntityFramework and Sqlite.
I started initially with a WPF app, but I decided to abandon and move to UWP mostly because there are more controls supported (AutoSuggestBox).
I am following the documentation steps: https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio, but I get errors at every step:
Installing the package
Install-Package Microsoft.EntityFrameworkCore.Sqlite
Package Microsoft.EntityFrameworkCore.Sqlite 5.0.3 is not compatible with uap10.0.17763 (UAP,Version=v10.0.17763). Package Microsoft.EntityFrameworkCore.Sqlite 5.0.3 supports: netstandard2.1 (.NETStandard,Version=v2.1)
Why do I get an error message about netstandard??? Shouldn't EntityFrameworkCore be compiled with .NET Core?
2. After some research, it seems that I need to install the 1.0.0 version of these package. After installing both EntityFrameworkCore.Sqlite and EntityFrameworkCore.Tools, I create a ApplicationContext with a model and I want to add a migration:
Add-Migration First
I get another error:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Checking my PC, I have the correct System.Reflection.TypeExtensions.dll in several location:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Reflection.TypeExtensions\4.0.0\lib\DNXCore50
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Reflection.TypeExtensions\4.0.0\lib\net46
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Reflection.TypeExtensions\4.0.0\lib\netcore50
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Reflection.TypeExtensions\4.0.0\lib\dotnet
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\System.Reflection.TypeExtensions\4.0.0\lib\net46
However, I see that on compilation, the DLL is only searched in 2 locations:
%HOME%/.nuget/packages/microsoft.entityframeworkcore.tools/1.0.0/tools/net451/
$(ProjectDir)bin/x86/Debug/
The most annoying thing is that ~3 months ago I did the same exact steps and everything (step 2) worked flawlessly, yet now I am struggling with basic things.
Edit: After some digging with procmon, it seems that the working project is compiled with netstandard1.3 and MSBuild, while the one not working is compiled with microsoft.netcore.universalplatform\6.2.10.
Try lowering Target Version to Windows 10, 1803 and Min version to 15063

.NET Standard library - Could not load file or assembly 'System.Runtime.Caching'

I build a library using the latest .NET Standard version. It all works OK.
The problem occurs when I add the System.Runtime.Caching NuGet package. I tried to add all stable versions from 4.5 to 4.7. I get the following error for any version, when trying to use classes from this package.
Could not load file or assembly 'System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified."
In Asp.Net core app, i was referencing some libraries and it caused an issue when i tried use those libraries.
I had to add System.Runtime.Caching, because my libraries were unable to find them, which is not available by default in asp.netcore web api project. Hope this will help someone. You can install them from nuget package manager.
Uninstall System.Runtime.Caching package with NuGet package manager and close your visual studio. Than install this package again.
If it's not fixed the problem , check your csproj file and references in your project for version conflict or mismatch.

C# - Xamarin.Froms.Build.Task.GetTaskAbi - error

I have been getting the below error everytime I try to build a Xamarin Forms App.
Does anyone have a solution to this error.
I have uninstalled and reinstalled VS2017 two times.
I have deleted all the folder to do a clean install.
Severity Code Description Project File Line Suppression State
Error The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\Regardt.nuget\packages\xamarin.forms\3.0.0.446417\build\netstandard2.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. App2.Android
Download and install .NET Framework 4.7.1 or 4.7.2 then seemed to resolve the issue.
Microsoft .NET Framework 4.7.1 (Offline Installer):
https://www.microsoft.com/en-us/download/details.aspx?id=56116
Microsoft .NET Framework 4.7.2 offline installer for Windows:
https://support.microsoft.com/en-us/help/4054530/microsoft-net-framework-4-7-2-offline-installer-for-windows

Categories