locked
VB app to mac RRS feed

  • Question

  • Hi Experts,

    I have written a little app originally in VB. The idea came up to port this to Mac.

    So the first thing was to convert VB to C#. Was painful enough as I had no experience at all in C#. Finally I managed to get everything up and running in C# - on Windows!

    The next step was to find a Mac and install Visual Studio for Mac. Got this solved as well and thought my app would run immediately on Mac as well as it does on my Windows-PC.

    Well - no chance! Get Warning and Error of the following kind:

    Could not read state file "obj/Debug/App.csprojResolveAssemblyReference.cache". The ObjectManager found an invalid number of fixups. This usually indicates a problem in the Formatter (MSB3088)

    Error:

    Cannot open 'Volumes/AppStick/App/App/obj/Debug/App.pdb' (CS2012)

    As you probably assume, the App is on a USB-Stick together with all the references (dll's) I need to run this app.

    My question now:

    Do I need to change all references to dll's that came with Visual Studio for Mac or are the dll's copied from Windows good enough? If not - were are the dll's located on Mac? Any explanation of the messages I get on Mac?

    Would be great if someone could help me with some directions!

    Regards

    HGVS

    Saturday, July 1, 2017 9:20 PM

Answers

  • Hi Cor,

    to get from VB to C# I used SharpDevelop 4.4. It offers an automatic conversion from VB to C#.

    It is not perfect but does an average of 90% correct conversion. It didn't compile then without errors (e. g. when you have a string-split char - in VB you put it in "|", in c# it needs '|').

    These where the nitty-gritty things I was confronted with. Finally it worked fine as the VB-Version did. Was quite some effort.

    Sad to see that a conversion of a medium-complex app seems to be impossible.

    I think, a totally mac-centered development to imitate the functionality of my vb-app would be the right way.

    To sad that MS does not see the potential that a clean path into the mac-world would offer.

    Thank you all for your time and input!

    Best Regards

    HGVS

    • Marked as answer by HGVS Friday, July 7, 2017 1:07 PM
    Friday, July 7, 2017 1:07 PM

All replies

  • Hi HGVC,

    Do you get error when you convert VB to C#? If yes, could you provide code for us to test?

    Could you try Ctrl+F5 to run the project? Ctrl+F5 will launch your application outside of the debugger. 

    Does the project is on USE-Stick when you run the application to get the error? Could copy the application on your Mac and run it?

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 4, 2017 6:42 AM
  • Hi Wendy,

    thanks for your reply!

    To your questions - no, I don't get the error by converting from VB to C#. My C#-Version is running on my Win-PC without error. Of course I had severe problems to get from VB to C# on Windows. But this is solved.

    I have now the Visual Studio suite running on Mac (El Capitan). When I take the project to Mac (via USB-Stick...) then the described warning and error shows up.

    I will pick up your Idea and copy the project to the Mac directly and to run it again. Can't try this immediately. Will happen later the day. Will come back with the results.

    Regards

    HGVS

    Tuesday, July 4, 2017 8:19 AM
  • Hi Wendy,

    didn't work to copy everything local. Same problem. New things appear when I try to to use F5 to start the app - then it seems to loose references - "winapi.dll not found" for example!

    I went back to my win-environment (win7 and 10) to check the c#-code. Works perfect! No errors, no warnings, no lost references.

    Back to one of my first questions: can I use dll's that came from a win-environment?

    Background: To make my little app "portable" I have referenced every dll I need to a directory on the usb-stick (dll-ref). This works fine on windows.

    The question to me now is - how is Visual Studio for mac implemented. Does it have a "mac-set of dll's"? Or can a win-dll be used and the interface to mac is done with the "intermediate-language"?

    I simply don't know that. Maybe you do?

    Regards

    Hans

    Tuesday, July 4, 2017 8:48 PM
  • Hi Wendy,

    just another question - is e.g. App_Client_File.pdb a valid Mac filename?

    As error CS2012 is the message that the .pdb-file can't be accessed, or the filename is not valid.

    Regards

    HGVS

    Wednesday, July 5, 2017 12:57 PM
  • Hi HGVS,

    Like this case:

    https://stackoverflow.com/questions/40878149/is-it-possible-to-use-dlls-with-visual-studio-mac

    My understanding is that Visual Studio for Mac doesn't support all dll files of windows on the Mac.

    No the same sample as yours, but if we create a simple console app with the default .NET Framework library, if we copy it to the mac Environment, we could run the app normally in VS for mac. 

    As you said that the same app works well in windows, but just in mac, so one issue is that whether you could create a simple similar app in your VS for mac.

    >>Back to one of my first questions: can I use dll's that came from a win-environment?

    For this issue is that we have to make sure that this dll file was compiled and support the MAC Environment like the .NET core or others.

    Of course, you could share us a simple sample using one drive, we will test it in our side using the MAC Environment.

    >>just another question - is e.g. App_Client_File.pdb a valid Mac filename?

    >>As error CS2012 is the message that the .pdb-file can't be accessed, or the filename is not valid.

    Whether it was related to the filename? For example, change and compile the project name from  App_Client_File to AppClientFile without special symbol.

    In addition, during debugging, it would load the symbols file(pdb file) with your library or .exe, the debugger first checks to see if the symbol file exists in the location that is specified inside the DLL or the executable file. So I think we also need to think about the dll file firstly, for example, whether it really supports the MAC Environment.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 6, 2017 7:06 AM
  • Hi Jack,

    thanks for your input!

    More and more I think as well that the key point are the dll's! I need quite some as I try to make my app "portable". To achieve this I carry all necessary dll' on the USB-Stick and have them referenced inside the app.

    I also tied to eliminate "special char's" with the filename (like the underscore). Didn't help.

    Here the list of dll's I need to run my app:

    hnetcfg.dll, Interop.NATUPNPLib.dll, Interop.NETCONLib.dll, Interop.NetFwTypeLib.dll, ManagedWifi.dll, System.Core.dll, System.dll, System.Drawing.dll, System.Management.dll, System.Windows.Forms.dll, System.XML.dll, System.Xml.Linq.dll.

    Quite sure that some of the listed dll's exist on Mac side. I have unfortunately no idea where to look at on the Mac, as this system still is a mystery to me. Need some time to navigate in this system.

    The thing for me is - as you stated - how to get (for my app..) the missing dll's recompiled on Mac?

    I just wanted to find out, if there is a decent way to port a medium-complex app from Windows to Mac. More and more I think that this is a sort of "mission impossible".

    Regards

    HGVS




    Thursday, July 6, 2017 6:58 PM
  • Hi HGVS,

    What I know that the VS for mac will use his dll file if you open a simple .NET project created in windows, it seems that it has his own Framework(called Mono Framework) to cover the general dll file of .NET Framework.

    But for other dll files, I think you need to check the reference windows in your VS for MAC. No documents list all the dll files supported between windows and Mac. Sorry for that.

    Or you could report this issue here, I think you could get directly answer from the VS for Mac experts:

    https://developercommunity.visualstudio.com/spaces/41/index.html

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 7, 2017 9:59 AM
  • HGVS,

    Converting it from VB (Net) to C# is the same as when you need a car chair by breaking of the rocking part of an old rocking chair.

    The design way of a Mac application is (mostly) complete different from C# and VB.

    Therefore tell something what you use to make the App (Version of Visual Studio, Kind of Template....................)

    That you converted VB is only confusing. I saw Wendy converting very nice Chinese C# code to VB using a converter. 

    Probably the Tangible one. 

     


    Success
    Cor

    Friday, July 7, 2017 10:21 AM
  • Hi Cor,

    to get from VB to C# I used SharpDevelop 4.4. It offers an automatic conversion from VB to C#.

    It is not perfect but does an average of 90% correct conversion. It didn't compile then without errors (e. g. when you have a string-split char - in VB you put it in "|", in c# it needs '|').

    These where the nitty-gritty things I was confronted with. Finally it worked fine as the VB-Version did. Was quite some effort.

    Sad to see that a conversion of a medium-complex app seems to be impossible.

    I think, a totally mac-centered development to imitate the functionality of my vb-app would be the right way.

    To sad that MS does not see the potential that a clean path into the mac-world would offer.

    Thank you all for your time and input!

    Best Regards

    HGVS

    • Marked as answer by HGVS Friday, July 7, 2017 1:07 PM
    Friday, July 7, 2017 1:07 PM