.net-corevisual-studio-publish

Visual Studio Publish looking for dependent dll in wrong folder


I have a .Net 8 function app (DRIContactServiceUpdate) and a web app (DRIContactManagement) in a single solution. The function app is dependent on the web app. Everything runs fine when I run the function app on my local machine. I'm trying to publish the function app to Azure, it builds but fails during Publish for C:\Users\Chris\source\repos\DRIContactManagement\DRIContactManagement\obj\Release\net8.0\win-x64\ref\DRIContactManagement.dll' could not be found The problem is, win-x64\ref doesn't exist. I found where the build was copying the dependent file to the function app as I expect:

Copying file from "C:\Users\Chris\source\repos\DRIContactManagement\DRIContactManagement\bin\x64\Release\net8.0\DRIContactManagement.dll" to "C:\Users\Chris\source\repos\DRIContactManagement\DRIServiceUpdate\bin\x64\Release\net8.0\DRIContactManagement.dll".

The only place I find win-x64 referenced is in the Publish settings but I can't find a path defined referencing that folder.

enter image description here

I've tried all the typical solutions:

  1. Clean and Build
  2. Delete the bin and obj folders in both projects and rebuild
  3. Restarted Visual Studio
  4. Remove the project dependency and re-add it.

I can't find anything online quite like this but I'm sure it's not unique. Any suggestions?


Solution

  • After a lot of searching I found this discussion: https://developercommunity.visualstudio.com/t/clickonce-publish-metadata-file-could-not-be-found/1430499

    I still don't know what is causing the issue but the work-around is to switch the publish profile's Target Runtime to "Portable".