Microsoft Visual Studio unable to start program assemblyx86 - visual-studio-2010

So I've been having this problem for a while it is usually a hit or miss. Sometimes I get the error, sometimes I don't.
I'm working on assembly x86 and everytime when I try to create a new project for .asm files, I get an error of the following
Unable to start program
...\Debug\DefaultProjectname.exe
The system cannot find the file specified
These are steps I use to make a file
Create project
Build MASM dependencies
Link Irvine library in additional dependencies
I'm able to build solution so that is kinda weird
Also, I'm trying to find a way that allow me to skip all the steps above and copy the default template

Related

Manually compile VB6 project using LINK.EXE and C2.EXE

I would like to try and avoid the VB6.exe application when trying to compile my project. It tends to create the *.obj files and then crashes leaving me with no idea what went wrong.
"c:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE" /m MyProject.vbp
I would like to try and use LINK.exe and C2.exe to compile my application instead. I found a really great article located here on the process with all the switches etc. I was hoping someone has tried something link this and been successful so they can tell me exactly what switches I need to use and a step by step process of how to create the object files and then link them all to the EXE.
I ended up getting this old source to compile. I'm sure my situation was unique but I thought I would share in hopes of helping someone else find their way if this happens to them.
First, I could NOT get this one project to compile to save my life in the end. At first it would compile in the IDE, then only by running the following in a command line...
"c:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE" /m MyProject.vbp
Then that would not even work and I had to use the package and deployment wizard to compile it which worked some of the time.
I think it was really just hit or miss in the end. But at some point something pointed to a specific module file I had that was used to access (read/write) the registry. I think it was between looking at logs and maybe even the windows event viewer etc. So I started thinking... Maybe it will compile if that was not used. So I removed the module from the project, tried to compile, then VB was nice enough to show me every call that would not work because the referenced function did not exist. I commented out all of those as well then I was able to compile with very little effort and it went smooth again!
So that helped me identify what VB was flipping out about but it did not solve the underlining issue (that I could not compile ALL of my source). So I started trying to work all the source back into the application one by one to see where it would break at.
I first added the module file to the project and just compiled.
Success!
I then tried to uncomment the first thing I commented out (reference to the function in that module) and then recompiled.
Success!
I managed to get all the way back through all my commented out lines of code and put them back the way they were originally. I then recompiled for the final time.
Success!
So at this point I had EVERYTHING back to the exact way I had it before I started trying to compile. Now it works with no issues at all!

Create Visual Studio Project for building using command

I have a solution where there is a dependency on 7zip's sfx. Out of desire to keep the entire solution (plus the sfx) managed and coordinated, I want to create a new project to house all the source files that is used by sfx, and when building, execute a command line that tells 7zip to build a sfx from the source files, and place into the output so that it can be then referenced by actual Visual Studio projects within the same solution.
I think I can figure the command line by using Build events and providing the appropriate macros to ensure that the 7zip's output is placed into the target folder with appropriate name so that it can be then correctly referenced by other VS projects. But what I am not sure about is what Visual Studio project I need to use or steps to take to tell Visual Studio that there isn't going to be any code to be compiled in this project and it just has to execute this script I give it.
The closest thing I can come up with is VS's Make project but I don't know if that is the right thing since this has nothing to do with Make at all.
So, what is the Visual Studio project template I need to use? If empty, then what configuration do I need to perform so that it won't try and look for some code files to compile but instead just execute scripts as part of the solution's build?
For now, it seems that using C++ Makefile Project works. I had to make few configurations:
1) I had to specify the project's "Configuration Type" as "Utility"
2) I used Pre-Build event and provided a command to invoke a batch file included in the project. The batch file then takes care of everything.
3) Normally, non C++ files are not considered for determining whether build is needed or if it's already up to date. To ensure that a new build is perform if the batch file or other key files are edited, I set the file's "File Type" to "MakeFile". Even though it isn't actually a Make file, it ensures that any edits made to the file will cause a new build.
The downsides I've found so far are:
1) C++ uses "Filters", not folders. Therefore, keeping the files in same directory structure is a big PITA. One can "include" files and get a one-to-one mapping between "Filters" and the actual directory structure on disk but it's annoying and tedious. Wish it was a C# project
2) I'm a bit wary about how it will detect new files or other changes for files that I didn't explicitly set to "MakeFile". I expect the source to be stable but I worry that when I realize I need a new file and add it, I might forget and not notice that the build is not correctly including the new file.
I'm not sure if this is the best method but this works for my purpose - having a project to manage external tools as part of bigger build process.

C++ project using Windows Event Log

I´m trying to learn the concept of writing events to Windows Event Log using Manifest and I followed the documentation provided by Microsoft.
I´ll describe the steps I took and where it went wrong. Hopefully someone can tell me whats missing or what I'm doing wrong.
Created a Instrumentation Manifest using ECManGen.exe proving information about the provider (C++ Console application), e.g. path to .exe-file. Created channels for all the type (Debug, Administration, Operational, and Analytic). Finally created an event that I
later wanted to write to log. (Also created Tasks and Keywords to organize the Event).
Created a new project in Visual Studio 2013 (C++ Console Application) and included the Manifest (.man) file.
Changed the build settings for the Manifest file to Custom build tool and set command line to mc -v -h . "%(FullPath)" and output to %(Filename).rc;%(Filename).h;.
I then built the project with no problems generating the .rc-file, .h-file, and .bin-files.
After the build I included the all the files to the project generated in Step 4 and rebuild. The rebuild generated the .res-file out of the .rc-file and the resource tab looks like this:
Project
-Manifest.rc
-11
The last step was to register the provider with wevtutil im Manifest.man and this is where I get the error. I received the following error:
Warning: Publisher GGSProvider resources are not accessible.
Failed to open metadata for publisher GGSEventManifest.man. The system cannot find the file specified.
Does anyone see what is wrong or can provide a simple step-by-step guide?
Thanks for any contribution!
The resourceFileName and messageFileName attributes in your manifest file must point to the full path of your dll. You cannot use environment variables in that path.
See http://msdn.microsoft.com/en-us/library/windows/desktop/dd996926(v=vs.85).aspx.
I did the following steps but with an DLL-project and it works fine. Can someone explain this behavior?
The next task is to create an event!

Error loading some.dll: Unable to load the test container 'e:\some.dll' or one of its dependencies

I have a VS2010 C# project, that references a large set of native .dll's (a commercial java runtime). These file are referenced as 'Content' files in the project, since the need to be copied with the project.
The code in these libraries is called using PInvoke, there is no assembly reference.
Every time I compile the solution, the Visual Studio testing framework tries to load all the referenced dll files, expecting to find .net assemblies which may contain unit tests. Since the are no .net assemblies, the following exception is thrown:
Error loading some.dll: Unable to load the test container 'e:\some.dll' or one of its dependencies. If you build your test project assembly as a 64 bit assembly, it cannot be loaded. When you build your test project assembly, select "Any CPU" for the platform. To run your tests in 64 bit mode on a 64 bit processor, you must change your test settings in the Hosts tab to run your tests in a 32 bit process. Error details: Could not load file or assembly 'file:///e:\some.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
This takes a whole lot of time, and I would like to tell Visual Studio to not try to load these files.
How can I tell Visual Studio to stop trying to load these files?
Correct me if I got this wrong:
You are including the P/Invoke target binaries in to the VS solution because you want the binaries to be copied over to the target directory when the solution is built. You want this because the project will execute from the target directory as soon as the VS solution is built. Correct?
Often times VS packages (both default and 3rd party) try to get smart about the solution content and will follow certain triggers (which are difficult to contain and control by ourselves) and load the solution and project content in their own ways. Fighting the battle in this area has poor ROI than employing a simpler work around (below).
While I can't provide you with an authoritative answer on how to tell VS's test package to not load all binaries, I suggest removing such binaries from the project as 'content' and leave them in your source control where they are today. Add a post-build task that will copy the said binaries over to the target. This will still give you the same result as it is working today but, takes those binaries out of reach for the test probes.
You must check out configuration settings by just right clicking on your solution name and click on "Configuration Manager"
It will open a pop up window for Configuration Manager.
Check not for the platform your projects are using it is better to choose any CPU.
Hope this can help.Give it a try:)
Because thats what your exeception says as you have quoted
Thanks
I tried to repro this issue and found that the root cause is that you have set your test project to be compiled as !AnyCpu. Is there any particular reason why you would want this for managed test code?
So unless you change this you will continue to see this message.
If you want to continue using this configuration for your test project you would need to update your .testsettings file as suggested in the message.
Sorry if this seems remedial. I am including it for the sake of completeness.
General library behavior
A library can be referenced either in the project file (and so the compiler injects to code to load the references) or dynamically at runtime with LoadLibrary() or PInvoke calls. When a referenced library is loaded, a function at the entry point is run can in turn load any libraries it depends on. When loading the library, there is a well-known set of paths that Windows will search, including %WINDIR%\Assembly and the current directory. There's a lot of good conceptual information on Wikipedia about this. I recommend reading it.
Possible Root Causes
I can't tell from your question if you are having trouble building the application, building the tests, or executing either. Generally I would not expect PInvoke to cause compile errors.
Error during app build: VS generally will show you that you have a reference to a DLL it can't find. However, you may be missing a DLL that is needed to satisfy all the dependencies. To resolve, just add the reference to the missing DLL. (This is the simplest issue, so I'm guessing this isn't what you're seeing.)
Error during test build: Since your test will reference your application/library, it also needs to have the same reference. Usually the easiest way to ensure you are getting everything is to remove all references and add a reference to the project you are testing. It's possible you some additional libraries are necessary for some tests, but not your app/lib itself. These need to be added separately.
Error during app execution: This can happen when starting the application, or later when an call to the external library is made if late binding is used.
Error during test execution: This can happen the same as with app execution. However, tests can also be "partially built" to only execute a small number of tests. In these cases, some files may not be copied. Using the [DeploymentItem()] attribute, you can specify that a test requires the presence of certain files in the test or app/lib project to function. MSDN describes how this can be done.
Resolution
For #1 & #2 the solution lies in adjusting the references in the project.
For #3 & #4, it may get trickier. There is a similar question to yours regarding Windows Mobile here which you may find useful, especially referring to using dumpbin to list out library dependencies. You can also use procmon from SysInternals to monitor file access during compile or load to see which files are not found. Then you can either include the missing file, or remove the library referencing it.
Good luck. Hope this helps.

VS2010 - add custom compiler for certain file extensions

I've written a command-line OpenCL compiler. I'd like to have VS compile my kernel source files using this whenever I build the C# project that includes them. I've looked around and found information and custom build tasks, custom tools, etc, but I haven't been able to get it to work correctly.
How can I tell VS to run my exe on the source files in the same way that it runs the c# compiler, etc for other files in the project?
I report errors from this tool by calling Console.Error.WriteLine(). This dutifully places the errors in the Output pane, where I can double-click them, taking me to the appropriate place in the .cl kernel source file. However, the errors don't appear in the VS error panel. ??
Alternatively, if anyone's aware of an existing OpenCL compiler - it's annoying to have to run the host application just to compile the kernel - I'd appreciate a link.
I've managed to get this working by adding a post-build step to the project options. However, I'd really prefer for this exe to be run for every *.cl file in the project.
Update I had neglected to include an error code when formatting my error messages. Correcting them to match any of the formats listed here took care of that issue. Still trying to figure out how to associate an exe with a given file extension, though.

Resources