Related
I've recently bought a new tower and used third-party software to port across all my development tools (another story in itself), including VB 6.0, all my third-party tools, and Btrieve. The only problem I have with Btrieve is more an annoyance than anything. On this new tower, I have to remember to run my compiled application once before attempting to run it from inside the IDE or else it will not load, and subsequently return a corresponding error when it attempts to open the first file.
If anyone else has encountered this and knows how to fix it, I'd much appreciate it.
After checking this page on Wikipedia I realized that I needed to focus on two files: w32mkde.exe and wbtrv32.dll
By manually running the exe file, it would load the engine and my application would then run in the IDE, but I still had to manually start the exe. The desired and original behavior on my older machine was that running my program in the IDE would automatically launch the sever exe. From the Wiki page, I learned that it was wbtrv32.dll that was actually called by the program, which in turn would call the exe if needed.
I had recentl ported over my old machine to a new tower, and many of the ocx and dll files in \windows\syswow64 did not make it. There seems to be no pattern to which ones, but I had to re-register those as I found them. There must be some link there, because when I copied-over the W*.exe and W*.dll files from my production backup folder to the syswow64 folder, it suddenly worked again. Likely just a corrupt copy of the dll file. I believe the reason that the compiled version ran correctly is because those dll and exe files were installed to the application folder, and were apparently okay, but not being invoked when run from the IDE.
Hope this might help someone else some day.
I am developing a VB.NET (4.5 framework) solution in Visual Studio 2015, Win10 OS, and have been able to run the builds uninhibited for several months, but now I am receiving the following error upon starting the build:
vbc : error BC2012: can't open
'C:\MyProject\ProjR5\ProjR5\obj\Debug\ProjR5.exe' for writing: Access
to the path 'C:\MyProj\ProjR5\ProjR5\obj\Debug\GenTagR5.exe' is
denied.
At first, VS2015 would give me the option to run the last successful build, but even that is no longer an option. After exhaustive internet searches on this problem, none of the dozen or so given solutions are solving my issue.
Here is what I have tried in order to resolve the error so far:
Ran sfc /scannow (elevated prompt)
Using ProcessExplorer, find handle or DLL substring that included my project
Made sure there were no hanging procs (including procs with my project name, devenv.exe, [project].exe, [myproject].vhost.exe, etc.)
Restarted VS2015
Restarted VS2015, running "as Administrator"
Restarted Computer
Full Shutdown of computer
Complete Rebuild of Solution
Build->Clean Solution
Build->Clean Solution, then Build->Build Solution
Build->Rebuild Solution
Uninstalled and Reinstalled VS2015
Disabled all indexing
Removed "Read Only" attribute from entire project folder and files within
Checked startup scripts for like- or identical processes
Disabled all AV apps
Disabled all antispyware apps
Disabled all firewalls
Verified that Application Experience (services.msc) wasn't disabled (I'm using
Win10 ... it isn't even in the list of services)
Set Tools->Options->Projects and Solutions->Build and Run->Max. parallel
builds to 1
Rerun aspnet_regiis.exe (under .NET\Framework)
Checked Local Security Policies and verified account was listed under
"Impersonate a client after authentication"
Removed \bin and \obj folders
Put \bin and \obj back when removing them didn't help
Removed \bin and \obj folders, then Rebuilt
None of these have worked. Any suggestions?
The problem ended up being Samsung Magician's Rapid Mode losing data during its write-caching phase to my solid state drive. I turned off Rapid Mode, and now the project builds without any problems.
Sorry for came too late, but i had this problem and i wanted to show how i fixed for the next devs who need a solution:
It's quite simple, just change your proyect assembly name:1) On your solution explorer: Right click on your proyect.
2) Properties>> aplication>> assembly name>> change it.
3) Compile, run to test it.
4) Change the name again if u wanted the original name.
Adding a description:
Changin the assembly name
New 2 programing in VS but i had same problem of Access or Write exe file ON BUILD.
Problem came out of nowhere. I didn't use or make changes 2 exe file in months,
made exe file, used it now and then and forgot about it....
Then after few months i wanted 2 start exe but no icon on desktop ??? ....tried everything, lost 3 days of searching inside code for error in VS and then called Google....
I read last comment ABOVE which mentioned Bitdefender, opened it and found BitD did block and isolate exe files ..... so i tried exluding files and folders which made problems inside BitD but no help....
So i went back 2 VS.
Within debug i got some X86 processor error which didnt make problem to build but it was warning (free component name in error description helped me ), - errors you can ignore but they are here on build ....
So i made last move before starting it all over again. Removed COMPONENT from application, deleted it on PC ...started VS from start .. and ALL was OK !!!
So in my case it was all about FREE component i used in app inside VS .... Bitdefender found some add / virus in it and blocked build progress.
BitD deleted or blocked exe file in start....
Hope this help anyone with similar problem !
The cause of this error for me was that Team Foundation Server had pulled in a bunch of files to my work space as Read-only. Not sure why it pulled them down from the server with read-only checked, but all I had to do was uncheck it.
Ok. Create a new solution and add its directories to the exception list and copy all your work, except for the '.vbproj' and except for the '.csproj' and the directory files to the directory of the directory of the new solution. I have tried that and it works, due that I have Bitdefender, it will be the only way to sort that issue. After doing so, try to build the app again. If it does not work, then I am definitely out of ideas.
I have a VB project was able to work without any issues, but now when i open the project i am getting the error with mscomctl.ocx.
I have re-registered the ocx but still am not able to load the project.
How can I fix this problem?
I was having this issue when I open the project on Windows 7 64-bit environment, it works correctly on win XP machine. I did a very simple change in project file earlier it says
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0; MSCOMCTL.OCX
I changed 2.1 to 2.0 because I have seen it like that in many forums and it worked like charm.
The updated reference in VBP file is
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
it seems to me your project has lost its reference to the ocx (while it still tries to use some of the controls)
click on 'components' in the 'project' menu in the ide
in the list make sure 'microsoft windows common controls 6.0 (sp6)' is checked ... if it already is, try removing it, close (and save) the project, open the project, and turn it on again
I had the same problem. user1272267 answer worked (thanks), but it bothered me that I didn't understand why, I also wasn't sure if I would end up breaking the project for my colleagues who it worked fine for.
So I did a bit more digging and found that in the registry there was a key; reg hkcr\typelib{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}\2.0 (Note the 2.0)
I changed the 2.0 to 2.1 and hey presto, everything worked fine. I also checked the DLL and it turned out my copy was older than my colleagues copy. I think this may be because when I installed service pack 6 I kept some of the original files when asked since the replacement files were for American english and I had the UK version, but i'm not 100% certain of this
I had a similar problem when my Windows 7 32 bit laptop crashed and the company replaced it with a 64 bit machine... first I tried registering the .ocx using regsvr32 - on the 32 bit machine it would get unloaded from time to time... this did not work at all on the refurbished 64 bit machine...
I tried changing the .vbp file settings as noted in some of the earlier responses without success... I set the .vbp back to 2.0 and later on another issue I was searching the registry and decided to search for mscomctl.ocx and found 3 keys - 2.0, 2.1 and 2.2... since it wasn't working I decided to delete the 2.1 and 2.2 keys and voila! the controls loaded without a problem. Clearly the .vbp and registry have to match.
you can also open the project file (.vbp file) in notepad where you see something like the following :
Type=Exe
Form=frmComFX.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Object={648A5603-2C6E-101B-82B6-000000000014}#1.1#0; MSCOMM32.OCX
Object={5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0; MSFLXGRD.OCX
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=frmSetup.frm
Module=modFX; modFX.bas
IconForm="frmComFX"
Startup="frmComFX"
HelpFile=""
Title="ComFX"
Command32=""
Name="comFX"
the lines that start with 'object-' contain the registry key with which the ocx is registered ... you can now open regedit (start - execute - regedit) and search for this key .. be careful though what you do in regedit, you might screw up your visual basic installation or even your complete windows :)
of course you can also remove visual basic and reinstall it to get the registrations back
I had this same error. These 2 things worked for me:
Start Visual Studio 6 by right-click Run as Admin
or
Disable the UAC prompt.
hope it helps.
Try re-registering MSCOMCTL.OCX:
download the file: http://www.ocxdump.com/ocxfiles/M/MSCOMCTL.OCX
copy it in location c:\windows\system32\
open command prompt and run this:
cd c:\windows\system32
regsvr32 MSCOMCTL.OCX
Than try to run your application again.
Windows 7 64 bit; just installed VS6 and VS6 SP6 (with difficulty)but my project from Win XP gave the "MSCOMCTL.OCX could not be loaded" error.
I found Nathan Hadley's answer gave me the clue and allowed me to open the project....
My userinterface.vbp file for the project (copied from Win XP) had #2.2 next to the MSCOMCTL.OCX reference but my registry class id had only 2.1.
So I changed my userinterface.vbp entry to 2.1 and the project opened ok.
However the next day I ran the VB6 SP6 cumulative update VB60SP6-KB2708437-x86-ENU again (may have not installed properly the first time) and now I have version 2.2 in the registry.
So I changed my userInterface.vbp file back so the OCX reference has #2.2 once more and now the project still opens correctly and all runs ok.
I have inheritted several old VB6 applications that currently cannot be rewritten in .NET. These old applications all use ADO, and compile fine on my XP machine. Since switching to a Windows 7 machine, the applications compile fine, but when they are deployed (on XP machines), I get errors. This is a known issue that this Microsoft article discusses:
http://support.microsoft.com/kb/2517589
The article give a very detailed explanation of a workaround, which involved copying a ".TLB" file and registering it using "regtlibv12". When I attempt to register it, I get this error message:
RegisterTypeLib of C:\Program Files\Common Files\System\ado\msado60_Backcompat.tlb failed : 80029c4a
I have also tried registering this using the old "regtlib.exe" in the Windows folder, but got this error:
LoadTypeLib of C:\Program Files\Common Files\System\ado\msado60_Backcompat.tlb failed : 80029c4a
Because of this, I cannot continue with the work around. I would greatly appreciate any guidance anyone could give me on how to properly register this file.
Thank you in advance!
Put the .TLB file in an appropriate place like
C:\Program Files\Common Files\System\ado
Then open a new Project in the VB6 IDE (elevated, i.e. as admin). Choose Project|References... then click the Browse button. Navigate to the new .TLB file and open it. Check the box to select the item and close the References dialog.
It should be registered now.
If desperate, try VB Type Library Registration Utility.
You probably downloaded the file as C:\temp\Msado60_Backcompat_i386.tlb and didn't rename it. The example is for registering C:\temp\Msado60_Backcompat.tlb (note, no _i386).
Run the command with the correct filename.
Just to update this answer list based upon more recent information, Microsoft released KB 2640696 which addresses this issue in a more straightforward manner. This patch makes it much easier to deploy on your build machines and solves the downlevel OS issue as well.
A more complete picture of the patch can be found on the following blog post.
Using Visual Studio 2010, when I build + run my application in short intervals I often get the following error. If I just wait a minute or two and try again it works fine. Unlocker claims no handle is locking the executable file. How can I discover what's locking it? If it's Visual Studio itself, what should I do to make it stop? or alternatively to release the file?
1>------ Build started: Project: MyProj, Configuration: Release Win32 ------
...
1>InitializeBuildStatus:
1> Creating "Release\MyProj.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> All outputs are up-to-date.
1> SomeFile1.cpp
1>ResourceCompile:
1> All outputs are up-to-date.
1>LINK : fatal error LNK1104: cannot open file 'D:\...\MyProj.exe'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.94
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Had this issue after a reinstall today. Make sure the Application Experience service is started and not set to disabled. If its set to manual, I believe VS will start it.
I'm aware this is quite old but I just had the same problem with Visual Studio 2010 all patched up so others may still run into this.
Adding my project path to "Exluded Items" in my AVG anti-virus settings appears to have fixed the problem for me.
Try disabling any anti-virus/resident shield and see if it fixes the problem. If so, add your project path to excluded directories in your AV config.
You probably had a stray build process that was locking the executable, and it (the stray process) didn't get cleaned up. In that case, shut down visual studio, open up process explorer, and nuke every process you can find that is related to visual studio.
Then open up visual studio again and try rebuilding your project.
the file can be locked because it is being run now. Try killing the process with a task manager.
Like Jonathan said, yes, renaming can help to work around this problem. But ,e.g. I was forced to rename target executable many times, it's some tedious and not good.
The problem lies there that when you run your project and later get an error that you can't build your project - it's so because this executable (your project) is still runnning (you can check it via task manager.)
If you just rename target build, some time later you will get the same error with new name too and if you open a task manager, you will see that you rubbish system with your not finished projects.
Visual studio for making a new build need to remove previous executable and create new instead of old, it can't do it while executable is still runinng. So, if you want to make a new build, process of old executable has to be closed! (it's strange that visual studio doesn't close it by itself and yes, it looks like some buggy behaviour).
It's some tedious to do it manually, so you may just a bat file and just click it when you have such problem:
taskkill /f /im name_of_target_executable.exe
it works for me at least.
Like a guess - I don't close my program properly in C++, so may be it's normal for visual studio to hold it running.
ADDITION:
There is a great chance to be so , because of not finished application. Check whether you called PostQuitMessage in the end, in order to give know Windows that you are done.
You might have not closed the the output. Close the output, clean and rebuild the file. You might be able to run the file now.
I've concluded this is some kind of Visual Studio bug. Perhaps C Johnson is right - perhaps the build process keeps the file locked.
I do have a workaround which works - each time this happens - I change the Target Name of the executable under the Project's properties (right click the project, then Properties\Configuration Properties\General\Target Name).
In this fashion VS creates a new executable and the problem is worked around. Every few times I do this I return to the original name, thus cycling through ~3 names.
If someone will find the reason for this and a solution, please do answer and I may move the answer to yours, as mine is a workaround.
I had the same problem, however using Codeblocks. Because of this problem i quited programming because everytime i just wanted to throw my computer out of the window.
I want to thank user963228 whos answer is really a solution to that. You have to put Application Experience on Manual startup(you can do it by searching services in windows 7 start menu, and then find Application Experience and click properties).
This problem happens when people want to tweak theyr windows 7 machine, and they decide to disable some pointless services, so they google some tweaking guide and most of those guides say that Application Experience is safe to disable.
I think this problem should be linked to windows 7 problem not VS problem and it should be more visible - it took me long time to find this solution.
Thanks again!
Just to add another solution to the list, what I've found is that Visual Studio (2012 in my case) occasionally locks files under different processes.
So, on a crash, devenv.exe might still be running and holding onto the file(s). Alternatively (as I just discovered), vstestrunner or vstestdiscovery might be holding onto the file as well.
Kill all those processes and it might fix up the issue.
I have just run into the same issue with VS2013, creating device drivers in C++ , and none of the above seemed to fix the issue. However, I have just discovered that in my case the issue appears to have been VMWare-related.
I was running a VMWare workstation client with a shared folder defined on the VM on my entire C: drive. When I disabled the shared folders on the VM Settings, VS2013 was able to happily build my .exe files.
My new process is:
1) Disable the shared folder on the vm (VM Settings | Options | Shared Folders - and uncheck the checkbox)
2) Run the build on the host PC
3) RE-enable the shared folder (and proceed from there)
Hopefully this might help someone else.
(BTW, the errors you receive are that the .exe (or other files) are locked or require Administrator permission, but that is a red herring - It seems to me that the VMWare share is causing those files to appear as locked.)
Usually, this means that your program is locked and might not be killed through task manager or process explorer. I met a similar case that my program had an exception during running and triggered the windows error reporting which locked the program. For the case that windows error reporting locks the program, you can go to control panel->System and Security->Action Center->Problem Reporting Settings to set "Never check for solutions". Hope it helps.
For me it was happening, when I was trying to build in debug mode, but it was working fine in release mode. I changed the build configuration in the visual studio from x86 to x64 and it worked fine for me, as I was running on 64 bit system.
I just had this issue in VS22 - I think I closed the debugger right when it was compiling. All I had to do was restart my computer.
The error comes (at least sometimes) from paths that are too long. In my project simply reducing the output file path does the job:
"Properties/Configuration Properties/General/Intermediate Directory"
Seems that I have hit the 250 character path limitation.
Working with Bjarne Stroustrup Programming Principles and Practice Using C++ "FLTK" example i got the same error but after like 1 hour i got an idea, i tracked one of the libs already seen in Project Properties -> Linker -> Input -> Additional Dependencies, in my case i tracked the kernel32.lib to see where was located and saw there were many kernel32.lib's in different folders. So i started copy the FLTK libs in those folders and the last one i tried worked. Visual Studio 2013 Express found the fltkd.lib and the code worked.
In my case the correct route was C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
I don't know how to set that route inside Visual Studio.
Not sure if that Windows kits folder was created when i installed Microsoft Windows SDK for Windows 7 and .NET Framework 4 (ISO) http://www.microsoft.com/en-us/download/details.aspx?id=8442
Hope that helps you people.
I just had thesame problem. With me the exe was still running but I could not end it with the Task Manager. Just by restarting VS, it worked for me.
Mine is that if you set MASM listing file option some extra selection, it will give you this error.
Just use
Enable Assembler Generated Code Listing Yes/Sg
Assembled Code Listing $(ProjectName).lst
it is fine.
But any extra you have issue.