I am using Visual Studio for Mac
, my application is written, it does what I want. The user's target platform is OSX. It relies on 2 Nuget Packages with their own dependencies, specifically:
- NetMQ
- Microsoft.Extensions.Configuration.CommandLine
I run the following command to build
the application:
dotnet build -c Release -r osx.10.11-x64
The output tells me it succeeded and shows me where it put the files.
Contained in that folder are the following files, this folder is what I assume I distribute to my user, but that leads to errors hence this question:
MyApp <---- executable
MyApp.deps.json
MyApp.dll
MyApp.pdb
MyApp.runtimeconfig.dev.json
MyApp.runtimeconfig.json
libhostfxr.dylib
libhostpolicy.dylib
So my user receives this and they have the dotnet
runtime installed. When they go to run the executable (Here MyApp
aka ./MyApp
)they receive the following error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'AsyncIO', version: '0.1.26'
path: 'lib/netstandard1.3/AsyncIO.dll'
Now, AsyncIO
is a dependency of NetMQ
so that's where that is coming from. However, I can ./MyApp
from anywhere on my filesystem and it works. So I'm left to think that the Nuget packages being installed on my system as the development system are still accessible where as on the new users's system they are not. I haven't really found any documentation pertaining to distribution from a Mac. The only thing I can think to do right now is to distribute the project files instead and instruct the user to run:
dotnet run -p MyApp.csproj
Which, if I understand correctly, will install the nuget packages.
I can also have the user use:
dotnet MyApp.dll
I have seen this form around in my googling. That begs they question though, of why an executable is generated though. Beggars can't be choosers, if the way to do it dotnet <dll>
I'm happy, I just need to get it to run.
There has to be something I'm missing here or else this detail, distribution, of netcore2.0 apps was just overlooked?
In digging around some more this also seems like a useful command:
dotnet publish -c Release --framework netcoreapp2.0 --runtime osx.10.11-x64
And that adds ALL kinds of DLLs and all of the dependency DLLs as well. Words like publish
make me think this is the way this needs to go.
These 2 links are where I am primarily getting my info:
https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli https://learn.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj