1

I would like to publish .NET Core 2 with Visual Studio 2017 15.4 – I have created console app and do only Console.Write and Read for test purpose. Next I would like to publish this for windows so I have changed project properties to:

<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>

When I’m trying to do publish with default stings I have and error “Publish failed” and output have this error “Could not copy the file "obj\x64\Release\netcoreapp2.0\win10-x64\ConsoleApp6.dll" because it was not found.” Another thing is that I can find exe in “bin\x64\Release\netcoreapp2.0\win10-x64” but after run there is no text I have written in my app but I can see “host-options:” and couple of options?

I don't know why error occurs and why I see “host-options:” after run the app?

dnf
  • 1,659
  • 2
  • 16
  • 29
  • Did you ever get this resolved? I am having the same error. – Michael W Riemer Jr Nov 02 '17 at 20:29
  • Nope - For now I'm using publish from command line without change to project config like in this post https://stackoverflow.com/questions/44074121/build-net-core-console-application-to-output-an-exe – dnf Nov 03 '17 at 18:03

1 Answers1

1

It seems to be a bug when using custom folders for different platforms with publishing. I have the same issue. The error indicates that it searches the ConsoleApp6.dll in the path obj\x64\Release\netcoreapp2.0\win10-x64. But in my case, the .dll file was in obj\x64\Release\netcoreapp2.0\.

My workaround was to copy the .dll file manually to obj\x64\Release\netcoreapp2.0\win10-x64 (and other platform folders) and then publish the app again.

This also resolves the "host-options:" problem you mentioned when running the app. This simply appears because it could not publish / build it successfully for the given platform.

COBRA.cH
  • 149
  • 1
  • 11