Calling all vb.net experts - help please!
Dr_Acula
Posts: 5,484
How would I write and compile a "Hello World" in vb.net?
I've been using Microsoft's Basic since back in the late 1970's, and even right back then it was possible to write a program, run it, and then when it was debugged, run it through a compiler and produce an executable file.
I've followed that through with almost every version of Basic and it has always worked.
Recently I needed to upgrade my PC from XP to Windows 8, mainly because vb.net does not seem to be supported in XP any more. I looked at vb.net version 2012 but this only runs on Windows 8 and Win8 is only on a tiny percentage of computers. So for developing for programs likely to run on the widest number of platforms, I settled on version 2010.
Download the vb.net program on a new Win 8 machine. Open up vb.net as a console application. Write this program, which is about as simple as it gets
Hit Ctrl F5 to run and it prints hello on the screen.
Now try to compile this. Compilation is called Publishing now, but I think it is the same thing. But it fails with two errors, as shown in the screenshot.
A search on these errors in Google takes one off on a long search through all sorts of sites. One helpful site said that there is a bug and it depends where the compilation is run from. If you run it from Project/Publish, it will fail, but if you go to the right side panel called Solution Explorer and right click the filename ConsoleApplication1, and then Publish, it will work. However, those sites seemed to be talking about C# and that somewhat promising avenue failed to help.
Another site suggested maybe it was something to do with certificates, but following their suggestions also didn't help.
Do any kind souls on this forum have any experience with compiling files on the latest version of Microsoft Basic?
Or is it finally, after 35 years, time to look at a non-microsoft solution??
I'm working on a multi propeller solution and one problem I've come up against is timing issues with downloading. The GUI version of a vb.net program running xmodem works, but it fails sometimes and I think it is due to the vb.net program having too many timing overheads. Judicious use of Application.doevents to pass control to shelled batch files helps to some extent, but I think it will work better with a "close to the metal" console line application run from a batch file. Of course, such a program is simpler than a GUI and therefore, many other programming languages would also be possible to use. All the program needs to do is read the parameters, open files on the disk, open comms ports, turn the data into xmodem packets and send out the data.
Any help here would be very much appreciated.
I've been using Microsoft's Basic since back in the late 1970's, and even right back then it was possible to write a program, run it, and then when it was debugged, run it through a compiler and produce an executable file.
I've followed that through with almost every version of Basic and it has always worked.
Recently I needed to upgrade my PC from XP to Windows 8, mainly because vb.net does not seem to be supported in XP any more. I looked at vb.net version 2012 but this only runs on Windows 8 and Win8 is only on a tiny percentage of computers. So for developing for programs likely to run on the widest number of platforms, I settled on version 2010.
Download the vb.net program on a new Win 8 machine. Open up vb.net as a console application. Write this program, which is about as simple as it gets
Module Module1 Sub Main() Console.WriteLine("hello") End Sub End Module
Hit Ctrl F5 to run and it prints hello on the screen.
Now try to compile this. Compilation is called Publishing now, but I think it is the same thing. But it fails with two errors, as shown in the screenshot.
A search on these errors in Google takes one off on a long search through all sorts of sites. One helpful site said that there is a bug and it depends where the compilation is run from. If you run it from Project/Publish, it will fail, but if you go to the right side panel called Solution Explorer and right click the filename ConsoleApplication1, and then Publish, it will work. However, those sites seemed to be talking about C# and that somewhat promising avenue failed to help.
Another site suggested maybe it was something to do with certificates, but following their suggestions also didn't help.
Do any kind souls on this forum have any experience with compiling files on the latest version of Microsoft Basic?
Or is it finally, after 35 years, time to look at a non-microsoft solution??
I'm working on a multi propeller solution and one problem I've come up against is timing issues with downloading. The GUI version of a vb.net program running xmodem works, but it fails sometimes and I think it is due to the vb.net program having too many timing overheads. Judicious use of Application.doevents to pass control to shelled batch files helps to some extent, but I think it will work better with a "close to the metal" console line application run from a batch file. Of course, such a program is simpler than a GUI and therefore, many other programming languages would also be possible to use. All the program needs to do is read the parameters, open files on the disk, open comms ports, turn the data into xmodem packets and send out the data.
Any help here would be very much appreciated.
Comments
It may be a rights issue, try launching Visual Studio as an Administrator. Not sure how you do that on Win8, on Win7 you just right click on the Visual Studio icon and select Run as Administrator.
C.W.
Serial port events ride on a secondary thread. You must take care when working with the serial port library.
Let me know if yo need any help at all...
...from my experience with VB2005 and VB2008, the "publish" feature does create a run-able application. I have not used VB2010.
Click Once is used to deploy windows applications from a web server or remote server. That's why I said kinda'. I could be wrong but I do not think Dr_Acula is trying to publish a console app to a web server and install the app to multiple users..
2010 is the same.
C.W.
http://msdn.microsoft.com/en-us/library/t71a733d%28v=vs.100%29.aspx
I'm not really sure where you guys are coming from...
If you do not need GUI Fluff, why not try FreeBasic ?
http://www.freebasic.net/
I've used that for some comms stress testing - produces nice small, stand alone EXEs (remember those ?)
There is also a good Debug development (written in FB)
http://www.freebasic.net/forum/viewforum.php?f=8
and the Debug also gives all source, so if you want to learn GUI in FreeBasic, it is a very good example.
IIRC their Open Com has many handshake options, and experiments showed not all handshake lines are the same...
here is a paste, and cryptic comment from way back... it can open any supported baud, this tests a skewed 9665
Interestingly, everything works fine on the XP work machine. So maybe it is a Windows 8 issue?
I've got a Windows 7 machine I can test this on - that might be the next step.
I suspect this might be the price to be paid for being an early adopter of Windows 8 *grin*.
FB claims Microsoft Windows, DOS and Linux. ? - or did you also want MAC support ? ( does vb.net do that ? )
RealStudio...aka "RealBasic":
http://www.realsoftware.com/
This package is supposed to provide multi-platform compilation for Windows, Linus, and Mac. I've had people tell me it's the bees knees, and I was seriously looking at it last year. My needs changed and I didn't choose to purchase the product.
This looked good last time I checked, but note that the $99 personal copy, does not tick "Deploy on Mac OS X, Windows, Linux"
- you need to get to $299 before that kicks in.
I think it also does not create stand alone .exe files.
( The Delphi Starter edition, is also windows only )
Someone who uses a MAC might comment on windows-emulators + comms handling of command line PC apps ?
If you need something more than FreeBasic, and MAC/OS-X support matters, then best is probably
http://wiki.lazarus.freepascal.org/Main_Page
http://lazarus.freepascal.org/index.php
The former is not very interesting. The latter still seems to be problematic. BASIC is not an attractive proposition, especially at the prices quoted above. There seems to be a dearth of cross platform tool kits anyway in any language.
C# is an option as the .NET run time is available for Mac and Windows. The resulting program will even run on ARM devices.
Qt is one of the best cross platform tools (See Simple IDE) but I remember you had issues installing it and C++ may not be your thing.
You can drive Qt GUIs from Python, a very popular and easy to use language. See PyQt : http://arstechnica.com/information-technology/2009/03/how-to-deploying-pyqt-applications-on-windows-and-mac-os-x/
Anyone else got suggestions?
I guess there is Java...
I want to clarify... Build in Visual Studio sends the binary output to the bin folder. By default, the bin folder is not visible in the solution explorer. To see the bin folder, select the project and click the "View all files" icon in the menu bar of solution explorer. Open the bin node and find the Debug and Release folders. Expand Debug and you'll see the binaries. Right click on the Debug folder and select "Open folder in windows explorer". Double click your exe to run the console application.
To create a release version (no debug symbols), select Release in the solution configuration drop down in the Standard tool bar and build. The output is directed to the Release folder.
Build is invoked when selecting Start Without Debug and/or Start With Debug, F5, ctrl-F5.
In my opinion, publish means to make public. It's a term used in web development for moving content to a web server. A little history... back in the day, Microsoft classic asp web pages contained script that executed on page request. You see that kind of thing today with PHP. This architecture creates spaghetti code because the same type of code is copied and pasted to many web pages or server side included. Enter COM and COM+ to encapsulate logic - that's another story. Anyway, back in 2002ish Microsoft released .NET 1.1. A completely different beast. An entire web site, excluding the HTML, became a dll. Now a developer could organize and share code across multiple domains. The term publish remained however. Today publish can mean many things in Visual Studio. For example, when I publish a site I also deploy DDL and DML - database stuff.
So... if ya just wanta' run the Hello World console, open the bin folder and double click the exe. If ya want other to run Hello World, give em' the binaries - or - publish and distribute the installation exe. The later will register the app in Windows.
Yes, that is the idea.
One problem with cutting edge things is coding in several languages at once. eg running three propellers in parallel with Spin code, using a vb.net IDE, with Spin being run through GCC to C++. It gets confusing with things like =, == and :=
So in an ideal world, all that would be done in one single language. And I guess that has to be C++.
Many of the problems I had with Qt were related to running a very early version of XP. I'm now got a desk setup with a Win7 and a Win8 machine side by side and things do seem much less problematic.
Qt or SimpleIDE or Code::blocks or C++ in .net or C# in .net.
So much seems to point to C++.
Right now I have xmodem in vb.net on the PC side talking to xmodem in Spin on the propeller. With the spin2cpp translation the xmodem on the propeller side is now in C++. It would be kind of cool to have the same language on the PC and on the propeller.
It's not a language thing. There are many languages out there. There is no single language to solve all problems.
However. I have a plan....
The single most easiest way to make a cross platform GUI now adays is in your WEB browser. No matter if you are Windows or Mac or Linux using Chrome or Firefox or IE the same GUI can work.
All that it needs is a little "glue" connecting the serial port to your Propeller to your web page.
That we will do with JavaScript running under Node.js.
If nobody beats me to it I hope to show a demo soon....
.NOT share
.NOT cross platform (without mono and who really ever wanted mono?)
Share?
Python
Perl
C++
With Qt
Browser based = good
JavaScript and Node = good
Heater? Demo PLEASE!!
Oh dear, now I actually have to do something:)
'the same' is always going to me more notional and semantic, than real, as eventually you need to hit the real world of libraries.
- but you can aspire to 'similar' or using the same/similar syntax.
I have found there is some activity on FreeBASIC on the MAC,
http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/2010-October/012337.html
http://rpg.hamsterrepublic.com/ohrrpgce/Compiling_in_Mac_OS_X
and a good list of 'candidates' seems to be here :
http://stackoverflow.com/questions/4110720/what-is-a-good-basic-compiler-for-mac-osx
so it may be a combination of Browsers for GUI, and FB (or compact equiv) for command line work, is practical and (moderately) portable.
Yes, please tell us more!
Ok, I did a bit of research. To send a file from a PC to a Propeller using javascript (or any other language) one would need to
1) Read some sort of config file with the directory location of the data file to read and the com port to use
2) Open text file for reading
3) Read data
4) Store data locally, in an array or something (can javascript do that?)
5) Send data out of a serial port
6) Display status and error messages as required.
7) Possibly automatically shut down the program at the end
Well, one thing Javascript should never be able to do is write to files on a computer http://stackoverflow.com/questions/2090747/write-local-file-with-jquery-or-javascript
If it can do that, what a wonderful platform for malicious virus code. I'm mildly disturbed that in that discussion thread someone said that it is possible. I sincerely hope not.
Fortunately, I don't think we need to write local files. Just read them.
Having used this in earnest for half a day, I think I like the idea of using an existing propeller editor as the Spin editor. Proptool or BST. Have three or more spin files open, one for each propeller in a multiprop solution. And have a simple batch file that does the compile/download. If one is editing three spin files at once, just need to remember to save all of them prior to a recompile. It isn't quite as good as having multiprop download as part of the IDE, but given we don't have access to source code for any propeller editor, it probably is the best we are going to get.
I am intrigued about the idea of GUI in a browser. If you can get it to talk to a serial port that would be very cool!
perhaps write to the Clipboard ? There will always be some need to read data into the PC.
The Spinneret can do this all day and program other Propellers. I posted an example some time ago in the Spinneret forum. I'll try to find it.
I can't say more because my knowledge fails me but Heater will be sure to pipe in to set us straight.
It really does look like a win/win combination for portable cross-platform tools.
This discussion has just reminded me there is a Basic inside OpenOffice, and it seems there is OpenOffice on OS-X ?
- so it is a similar idea to coat-tailing on someone else's large installation, only instead of a Browser, you use OpenOffice ?
Google finds this :
http://realterm.sourceforge.net/realterm_from_openoffice.html
and this
http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=31686
Sounds, like a nightmare.
I think the problem might be Windows 8, as there are no problems at all compiling exactly the same "Hello World" programs on Windows 7.
So this might be a rather serious Windows 8 bug. Right now, the solution I am using is to write my programs on the Windows 7 machine, and then copy them over to Windows 8.
For the purposes of creating simple programs that can run on multiple platforms, I am currently downloading virtualbox. Hmm, maybe I should run a win7 emulation on a win8 machine? *grin*
Addit: installing XP in virtual box on the Win8 machine. Slightly disconcerting when you get to the install part where it asks "reformat hard drive with NTFS"....
The error you are seeing are related to setup.dll not being in the expected location on the build box. The .NET Framework SDK installs the the files required to create a setup package. A Visual Studio install should register the files as well.