Re: Passing assemblies to mono runtime
Slide <[email protected]> Sat, 01 Apr 2017 17:34:13 +0000
| Newsgroups | gmane.comp.gnome.mono.general |
|---|---|
| Message-ID | <CAPiUgVdYOfrzEtxk=L6oO4XTsXDMKZzzB7OSgF=B1tssipUonw@mail.gmail.com> |
--===============8547464759149709010== Content-Type: multipart/alternative; boundary=94eb2c0b951e4b9b09054c1e563b --94eb2c0b951e4b9b09054c1e563b Content-Type: text/plain; charset=UTF-8 It looks like your assemblies that are references are not in the same directory as the exe. Visual studio will copy references, but mcs won't (and shouldn't) do that. If you want something similar to visual studio, use mono develop. On Sat, Apr 1, 2017, 09:12 Andreas Jung <[email protected]> wrote: > I have Visual Studio project that I am trying to get running with Mono. > > I could install all dependencies using > > mono nuget.exe install > and compile my application using > > mcs -r:RestSharp.105.2.3/lib/net46/RestSharp.dll \ > -r:JWT.1.3.4/lib/3.5/JWT.dll \ > -r:jose-jwt.2.2.0/lib/net461/jose-jwt.dll \ > -r:Newtonsoft.Json.10.0.1/lib/net45/Newtonsoft.Json.dll \ > Program.cs > Now I am trying to run the application using > > mono Program.exe > > Unhandled Exception: > System.IO.FileNotFoundException: Could not load file or assembly > 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, > PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. > File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, > PublicKeyToken=30ad4fe6b2a6aeed' > [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: > Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, > Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its > dependencies. > File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, > PublicKeyToken=30ad4fe6b2a6aeed' > So how do you pass the path to the assemblies to the Mono runtime > similar to the compiler? > > I tried to set $MONO_PATH but this is not working and not recommended > for Production. > > The overall question how the mcs compiler and the mono runtime could get > the information directly from the installed packages (using nuget.exe). > > Andreas > _______________________________________________ > Mono-list maillist - [email protected] > http://lists.dot.net/mailman/listinfo/mono-list > --94eb2c0b951e4b9b09054c1e563b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr">It looks like your assemblies that are references are not in= the same directory as the exe. Visual studio will copy references, but mcs= won't (and shouldn't) do that. If you want something similar to vi= sual studio, use mono develop.</p> <br><div class=3D"gmail_quote"><div dir=3D"ltr">On Sat, Apr 1, 2017, 09:12 = Andreas Jung <<a href=3D"mailto:[email protected]">[email protected]</a>>= wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8= ex;border-left:1px #ccc solid;padding-left:1ex">I have Visual Studio projec= t that I am trying to get running with Mono.<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> I could install all dependencies using<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> mono nuget.exe install<br class=3D"gmail_msg"> and compile my application using<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> mcs -r:RestSharp.105.2.3/lib/net46/RestSharp.dll \<br class=3D"gmail_msg"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-r:JWT.1.3.4/lib/3.5/JWT.dll=C2=A0 \<br c= lass=3D"gmail_msg"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-r:jose-jwt.2.2.0/lib/net461/jose-jwt.dll= \<br class=3D"gmail_msg"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-r:Newtonsoft.Json.10.0.1/lib/net45/Newto= nsoft.Json.dll \<br class=3D"gmail_msg"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Program.cs<br class=3D"gmail_msg"> Now I am trying to run the application using<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> mono Program.exe<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> Unhandled Exception:<br class=3D"gmail_msg"> System.IO.FileNotFoundException: Could not load file or assembly<br class= =3D"gmail_msg"> 'Newtonsoft.Json, Version=3D10.0.0.0, Culture=3Dneutral,<br class=3D"gm= ail_msg"> PublicKeyToken=3D30ad4fe6b2a6aeed' or one of its dependencies.<br class= =3D"gmail_msg"> File name: 'Newtonsoft.Json, Version=3D10.0.0.0, Culture=3Dneutral,<br = class=3D"gmail_msg"> PublicKeyToken=3D30ad4fe6b2a6aeed'<br class=3D"gmail_msg"> [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException:<br clas= s=3D"gmail_msg"> Could not load file or assembly 'Newtonsoft.Json, Version=3D10.0.0.0,<b= r class=3D"gmail_msg"> Culture=3Dneutral, PublicKeyToken=3D30ad4fe6b2a6aeed' or one of its<br = class=3D"gmail_msg"> dependencies.<br class=3D"gmail_msg"> File name: 'Newtonsoft.Json, Version=3D10.0.0.0, Culture=3Dneutral,<br = class=3D"gmail_msg"> PublicKeyToken=3D30ad4fe6b2a6aeed'<br class=3D"gmail_msg"> So how do you pass the path to the assemblies to the Mono runtime<br class= =3D"gmail_msg"> similar to the compiler?<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> I tried to set $MONO_PATH but this is not working and not recommended<br cl= ass=3D"gmail_msg"> for Production.<br class=3D"gmail_msg"> <br class=3D"gmail_msg"> The overall question how the mcs compiler and the mono runtime could get<br= class=3D"gmail_msg"> the information directly from the installed packages (using nuget.exe).<br = class=3D"gmail_msg"> <br class=3D"gmail_msg"> Andreas<br class=3D"gmail_msg"> _______________________________________________<br class=3D"gmail_msg"> Mono-list maillist=C2=A0 -=C2=A0 <a href=3D"mailto:[email protected]"= class=3D"gmail_msg" target=3D"_blank">[email protected]</a><br class= =3D"gmail_msg"> <a href=3D"http://lists.dot.net/mailman/listinfo/mono-list" rel=3D"noreferr= er" class=3D"gmail_msg" target=3D"_blank">http://lists.dot.net/mailman/list= info/mono-list</a><br class=3D"gmail_msg"> </blockquote></div> --94eb2c0b951e4b9b09054c1e563b-- --===============8547464759149709010== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTW9uby1saXN0 IG1haWxsaXN0ICAtICBNb25vLWxpc3RAbGlzdHMuZG90Lm5ldApodHRwOi8vbGlzdHMuZG90Lm5l dC9tYWlsbWFuL2xpc3RpbmZvL21vbm8tbGlzdAo= --===============8547464759149709010==--