I have a C# Console application that was developed in different machines. In this application, we chose to use Fody, because it's the only thing we found that would embed all external resource dependencies (any extra class libraries) into a single executable for our application.
Environment Detsils:
- Visual Studio Version: 16.9.2 (Professional 2019)
- Type: Console application
- Framework: .Net Framework 4.5
- Fody Version: 4.2.1
- Costura.Fody Version: 3.3.3
While this application worked without any issue in one machine, it starts giving trouble to another machine. We need to get this work on both machines as we need to cover lots of work. We have compared the two environments but couldn't figure out any difference.
the behavior of the issue is as below,
The first time when I clone and build a solution it goes in a never-ending path and I have no other option other than end tasking the visual studio.
And I observe that MSBUILD is occupied by something and I cannot end task it
The second time when I start the solution and build it, I am getting the following error.
Severity Code Description Project File Line Suppression State Error CS2012 Cannot open '<<obj folder path>>\Debug\Binary.exe' for writing -- 'The process cannot access the file '<<obj folder path>>\Debug\Binary.exe' because it is being used by another process.' Binary.exe <<project path>>\CSC 1 Active
I had to restart the machine to remove the obj folder. And once it is removed Same above behavior repeats.
I found below a similar question below thread,
Error during building application with PropertyChanged.Fody
But it seems like this feature is obsolete in the latest Visual studio as per the below question.
Disabling Visual Studio hosting process on Visual Studio Community 2017
Further, I have tried to set the environment variable as explained in the below thread as I thought its somewhat relevant. However, it doesn't work as well.
https://github.com/Fody/Fody/issues/537
I must use these Nuget packages in my solution. Highly appreciate it if someone can share some thoughts to sort out this issue