How to get .EXE file from TwinCAT XAE project to run on TwinCAT XAR - twincat

I hope this message finds you well. I have worked on TwinCAT XAE for past couple of months. I have developed and tested my programs on my Development PC using TwinCAT XAE and Visual studio.
Now I want to shift my programs from my development PC to my Runtime PC (Windows) which is eventually going to be installed by the machine. I want some guidance regarding transfering my programs from XAE to XAR. In simple words I want to know how to get the .EXE file to run on the TwinCAT XAR.
I am also facing some configuration issues with XAR. Can you share any installation guide or prerequisites for the TwinCAT XAR software

You cannot (and should not) make an .EXE file for your target platform (XAR).
.EXE files are run in Windows User Mode and is thus not Real-Time or deterministic.
TwinCAT code needs to be run in Kernel mode to ensure Real-Time and deterministic behavior.
Instead you should connect to your target through Visual Studio. You can change from to your target platform by pressing on Local and pressing Choose Target System
Here is a bit of information about how this works.
Afterwards you simply Activate the configuration and your code will run on the target platform.

Related

Visual Basic program cannot find DLL in applications root folder

I have built a program using Visual studio 2013 in visual basic. I am using a set of DLLs to communicate to some external hardware. The computer I developed the software on is a Win7 64bit machine and I can compile and run the software with no hiccups on it. I also have another computer (Surface Pro 3 64bit) that I use to test my software on and that works as well. Basically I just locate the debug directory of the development computer and copy the EXE and support DLLs to the new computer and run the EXE. This all works with my surface pro 3 computer.
My company purchased some other surface pro 3 computers for our production department and I am trying to get the software running on those as well. I do the same thing. Grab the EXE and support DLLs from the debug directory of the development computer. Except on these computers when I run the software program it tells me it can't find the DLL for the program. The DLL is sitting right in the application's folder, yet it says it can't find it.
I have tried multiple things, like publishing the software and including the DLLs in the installation, then running the installation on the "problem" computers. This still doesn't work. Same issue, it can't find the DLL.
This could be a number of things:
Incorrect version of .NET - do the new computers have the target version of .NET installed on them?
A required DLL is not being found, you should enable assembly bind failure logging and try again - How to enable assembly bind failure logging (Fusion) in .NET
So it turns out that the DLL I was referencing requires the VC++ redistributable packages to be installed on the computer. I downloaded and installed these on all of the problem computers and now the software recognizes the DLL and run.

Can I install Visual Studio without Admin rights?

I use a machine where I don't have administrator rights. I've been able to run programs without admin rights by extracting the program's .zip file to a directory I have created on my desktop. However, I can't find such a .zip file for Visual Studio.
Is there a way to install Visual Studio Community Edition without administrator rights?
Practically no. Visual Studio (Express and above, excluding VS Code) consists of multiple components that must be installed as admin, and will be required for the app you're debugging to be available as system-wide component. It might be possible to use ThinApp or its equivalent, but ThinApp can't even work with VS 2010 and it was by far the best of its class.
A (resource intensive) alternative to get VS on any PC will be packaging a VM with VS installed, either creating one yourself or get a ready-made ones. VirtuaBox is available as portable fork if you can't even get Hyper-V tools installed. But this still require kernel drivers installation, which means at least one-time admin access. Depending on your internet connection & budget, it might be more practical to setup a VPS with VS installed, then remote there.
Basically, youre going to need to download an iso of windows, then download QEMU, and run it as invoker by doing that batch file thing (https://techcult.com/how-to-install-software-without-admin-rights/). Set it to anywhere, and then figure out how to boot it to QEMU cause I have absolutely no idea how (ive only done it with Kali Linux). and just install VC on there. Sorry about being so vague.
There is no way to install or use Visual Studio on Windows without admin rights. You can either use a different program to write your code in and then compile using a different compiler. Or use qemu (since it does not require admin rights) to run a windows virtual machine.

opengl with windows 8

I just installed windows 8 and microsoft visual studio 2012. The problem comes when I try to run a program, it tells me:
the program can't start because glu32.dll is missing from your computer. try reinstalling the program to fix this problem
But I have already placed the glu32.dll in the locations that it should.
The graphics drivers shipping with Windows 8 lack proper OpenGL support. You must download the drivers from your GPU vendors website directly and install those.
Also when manually adding missing DLLs you should not add them to system directories, but into right into the directory of the application's .exe files.

Compile a Visual Studio program to run without installation

I'm writing a C# program in VS 2012 and am trying to figure out how to get it to run with having the user install it. What I'm looking to do is toss this small program out on the network and just have the users run it or put it on a USB drive and give it to them that way. How can I go about doing this?
Ask yourself this, why do installers exist? They exist to ensure that the client machine has all of the pre-requisites installed prior to running the application. Copying the bin directory will work, provided the machine has all of those pre-requisites, and if you can guarantee that (like in some corporate environments), then you are good to go.
If you are developing in VS 2012, then you may be targeting .net 4.5, which many people may not have installed on their machines. If you use any third party COM components then you will require steps to register those before you start your application.
If your application requires admin rights and the user doesn't run it as admin, it could fail unexpectedly, if you don't have an installer set it up properly.
There are a lot of scenarios that are helped by installers. If you have a very simple application, then all should be OK by copying the bin folder, but make sure you understand the scenarios where it will not work, so you know how to support it.

VB6 Application Silently Crashes on Startup/Form Loading

I have a VB6 app that loads initially (for a small prompt to enter a license key, only on the first time). It works fine on my machine (windows 7).
I had complaints of it crashing on someone else's machine (both xp and 7), so I made a Windows XP virtual machine. I installed it on the virtual machine, it crashed. I wanted to see where it crashed so I installed Visual Studio on the virtual machine so that I would get a debug prompt. When I ran the program again, it worked.
I am more familiar with C++ and had these kinds of problems, so I figured it was some sort of runtime issue.
I found this VB6 SP6 Redistributable Runtime:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=24417
I installed that, and it still wouldn't run.
Any ideas where to go from here?
Edit:
I have tried depends.exe, it only shows MSJava, which I've heard I can ignore. Does depends.exe also show things like .ocx (Active X controllers?) that are required?
Also, from the cmd prompt, %errorlevel% doesn't seem to get populated. Is that a VB6 things, or does that indicate that this is truely a crash and not a user exit?
Open the Visual Basic project and check both "References" and "Components" under the "Project" menu.
Since it is crashing with the VB runtime installed it is likely a component that you have referenced in the project that either does not exist (or is not registered) on the client under test.
This should be a simple fix.
I had the same problem on my windows 7 computer.
I have uninstalled everything, changed my windows theme to Windows Classic.
I changed following properties of VB setup file.
Right click on setup.exe and go to properties and in compatibility tab change the compatibility mode to windows XP SP2. And in settings uncheck the following check boxes.
Disable Visual themes
Disable Desktop composition
Disable display scaling on high DPI settings.
Run this program as an administrator
And have completed installation.
Followed by installing VB 6 service pack 6 from here.
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=24417
Hope it helps.
It may require something else other than just the runtime, have you tried viewing it with dependency walker http://www.dependencywalker.com/ on the machine that it crashes on?
It should quickly point out any missing references.
Maybe try again, create a new VM, but install the remote debugger instead of the full VS.
You should create an installer for your application. There may be more dependencies than just the VB6 runtime. A good installation tool will detect at least some of necessary dependencies for you. Have a look at this question or this question

Resources