EWSoftware / SHFB

Sandcastle Help File Builder (SHFB). A standalone GUI, Visual Studio integration package, and MSBuild tasks providing full configuration and extensibility for building help files with the Sandcastle tools.
Other
2.19k stars 369 forks source link

error CS0006: Metadata file ... could not be found #992

Closed gnimor closed 1 year ago

gnimor commented 1 year ago

I think this is hard to explain, but I will try to summarize the issue I am seeing. I have a huge solution with almost 150 projects. Two projects are sandcastle projects (shfbproj). After upgrade to the lastest Visual Studio (17.6.2) I am no longer able to rebuild the solution. During rebuild I get random errors like:

error CS0006: Metadata file 'D:\Code\MyLib.dll' could not be found

First I thought this is not really related to the sandcastle projects, but when I took a closer look at the build logs within Visual studio I could see that short before this error, one of the shfbproj file was compiled. Both shfbproj files compile "Additional content only".

Furthermore when I removed both shfbproj files everything seems to work fine - no build errors. In addition, when I compile the files alone (without running rebuild on solution level) I am also not able to see the issue.

EDIT

Just to mention: Sometime I see error like:

27>SHFB(0,0): error CT0001: Unable to clean output folder. Reason: System.IO.IOException: The process cannot access the file 'D:\Code\XXX\Anotherlib.dll' because it is being used by another process. 27> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 27> at System.IO.File.InternalDelete(String path, Boolean checkHost) 27> at SandcastleBuilder.MSBuild.CleanHelp.Execute() 27>Done building project "MyDocu.Documentation.shfbproj" -- FAILED.

Strange thing is that "Anotherlib.dll" (by the way I renamed my lib for this log) is not really related to the "MyDocu.Documentation.shfbproj". I am wondering why is the MyDocu.Documentation.shfbproj during rebuild trying to clean files which do not belong to the project file?

EWSoftware commented 1 year ago

Since you're only building additional content, it shouldn't have any interactions with assemblies. If you're directing output of the help file project to a common location with all your other build output, it's likely getting blocked trying to clear the output folder which will happen with website output. Let your help projects build their output in the default working folder under the help project folder and use the Output Deployment plug-in to copy the output to the final destination. The plug-in doesn't clear the output folder so shouldn't have any issues with other content being copied there concurrently.

gnimor commented 1 year ago

I guess you are right - I changed to default folders and as post build step I am copying the files to the desired place. All errors are gone. Thanks for your help!