0

I am trying to build an app using WPF based on the MVVM project. While learning, I found it tedious to have to implement the getter/setter for every property to notify the view of a change. That is when I learn about Fody

I tried to install the package using the following 2 commands

Install-Package PropertyChanged.Fody
Update-Package Fody

During the Install-Package PropertyChanged.Fody step, I got the following warnings

One or more packages could not be completely uninstalled: Fody.2.4.1. Restart Visual Studio to finish uninstall.

Then During the Update-Package Fody step, I got the following warnings

Uninstalling 'Fody 2.3.20'. Access to the path 'C:\WinProjects\Proj1\packages\Fody.2.3.20\netclassictask\Fody.dll' is denied. Access to the path 'C:\WinProjects\Proj1\packages\Fody.2.3.20\netclassictask\FodyCommon.dll' is denied. Access to the path 'Fody.dll' is denied. Successfully uninstalled 'Fody 2.3.20'. One or more packages could not be completely uninstalled: Fody.2.3.20. Restart Visual Studio to finish uninstall.

I tried running Visual Studio as Admin but that also lead me to the same results.

Now, when I build this project I get the following error

The "Fody.WeavingTask" task could not be loaded from the assembly C:\WinProjects\Proj1\packages\Fody.2.4.1\build..\netclassictask\Fody.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 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. WindowsClient

How can I solve this problem?

Jaylen
  • 39,043
  • 40
  • 128
  • 221
  • can u raise an issue here https://github.com/Fody/Fody/issues and include a solution that reproduces the problem – Simon Feb 27 '18 at 09:38

1 Answers1

0

I would first reboot your computer and then uninstall everything:

Get-Project -All | Uninstall-Package PropertyChanged.Fody -RemoveDependencies
Get-Project -All | Uninstall-Package Fody -RemoveDependencies

If necessary, repeat for both versions (Fody 2.3.20 and 2.4.1).

After you're done, install Fody again. If uninstalling isn't enough, delete all Fody files from C:\WinProjects\Proj1\packages

Francesco B.
  • 2,729
  • 4
  • 25
  • 37
  • I get the following error `Uninstall-Package : Unable to find package 'Fody' in 'Support'.` `Support` is one my the projects on my solytion – Jaylen Feb 20 '18 at 19:55
  • Not a problem, it's perfectly normal if you don't use Fody in Support. Go on with the other steps. – Francesco B. Feb 20 '18 at 20:00
  • When I remove `Get-Project -All |` from the command and run them I am able to remove the packages. I also delete the Fody folders from my packages folder manually. I installed the packages. When running the update I am still getting Access to path ...... is denied – Jaylen Feb 20 '18 at 20:00
  • Do those file exist? If so, right-click, properties, security tab, share with user "Everyone". – Francesco B. Feb 20 '18 at 20:03
  • I just saw that you're missing something. Run this in *NuGet* `Install-Package Microsoft.Build.Utilities.Core` – Francesco B. Feb 20 '18 at 20:05
  • 1
    I get the following error Install-Package : Could not install package 'Microsoft.Build.Utilities.Core 15.5.180'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files – Jaylen Feb 20 '18 at 20:21
  • `Install-Package Microsoft.Build.Utilities.Core -Version 15.1.548` – Francesco B. Feb 20 '18 at 20:26
  • Same error still. I think the `Microsoft.Build.Utilities.Core` is part of .Net Core Not .Net 4.5.2 – Jaylen Feb 20 '18 at 20:28
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/165518/discussion-between-francesco-b-and-jaylen). – Francesco B. Feb 20 '18 at 20:43
  • `Install-Package Microsoft.Build.Utilities.Core -Version 14.3.0` should be ok with your version – Francesco B. Feb 20 '18 at 21:02