When compiling, "Incorrect function" error - visual-studio-2010

I'm trying to build a VS 2010 web project and I'm getting this error:
Could not write to output file 'C:\Users\me\myProject\obj\Debug\myProject.dll' -- 'Incorrect function.'
I've tried everything from reinstalling to editing folder permissions to running visual studio as system to moving it to a different folder and nothing resolves this error. Has anyone seen it before, or know what to do about it?

Sometimes antivirus software "decides" that the .dll or .exe that we are building is malware. Many such apps also have some sort of a white-list of files for which you can tell the antivirus to ignore them.

Related

Projects not found in Visual Studio solutions

I have been getting errors in my previously functioning Visual Studio solutions.
These are stored on a network drive synced with the My Documents folder.
The error is:
"The project file '\\myfiles\users\myfiles\users\rgorr\My Documents\VSProjects\FMS\FMS4\FMS4\FMS4.vbproj' has been moved, renamed or is not on your computer."
And that's indeed the wrong directory. \myfiles\users\ is duplicated in the path.
However when I open the SLN file in notepad I see that the directory is "\\myfiles\users\rgorr\My Documents\VSProjects\FMS\FMS4\FMS4\FMS4.vbproj", which is correct.
If I try to edit this in the "File path" field in the properties window of the project that failed to load, I get an error: "Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))"
If I remove the project from the solution and re-add it, it will work. However once I save the solution and reload, it gives the original error.
Does anybody know what's going on here? It's been an issue with most of my solutions ever since migrating to a new laptop and grabbing them off of TFS. It persists in every version of Visual Studio I have installed.

Visual Studio 2010 - Cannot Register Assembly

I am running Visual Studio 2010 on a Windows 7 VM and trying to build a fairly large solution. When I try to do so, I get the error:
Cannot register assembly "C:\Development\ProjectName\Source\bin\Debug\AssemblyName.dll" - access denied. Please make sure you're running the application as administrator. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I have taken the following steps:
Confirmed that I am in fact running Visual Studio 2010 as administrator.
Restarted the VM.
Confirmed that the assembly does exist exactly where Visual Studio is looking for it.
Confirmed that administrator has full control over the relevant file.
Cleaned and rebuilt the project (multiple times).
I have also found that building the project which creates AssemblyName.dll, manually registering it with RegAsm, and then building the project which requires AssemblyName.dll does not result in an error, but this is not a desirable workaround as it requires manual control. Can anyone give me some advice on how to solve this problem?
Many thanks.
This particular issue happens when you are building an assembly project which has the 'Register for COM interop' checked under the Compile tab of the project properties. As Stephane said, you must right click -> Run as Administrator in order for it to register automatically.
If you already have the compiled assembly from a different machine, you can alternatively register it manually and reference the compiled assembly with the project to by-pass the issue.
When you ran VS2010, did you right-click and select "Run as administrator"? If not, it actually runs as a lower priviledged user. Once I selected "Run as administrator", this problem went away.
I also ran into this error even though I was running VS 2015 as administrator.
In my case I found that manually cleaning up (ie deleting) bin\Debug\*.* for the project resolved the issue. Apparently some kind of file permissions or something was preventing the operation, and the error message may have been incorrect.
I'm not sure what was causing the file 'conflict' in the first place.
Similar to what UuDdLrLrSs said, when I tried to clear the bin folder, Windows gave an error on file access. Apparently another process was using the file - in my case, Microsoft Access.
After closing the associated program that had a file handle, the project built fine. (Although I'm still a little confused as to why it had a file handle on debug assemblies...)

Typescript 0.9.1.1 in Visual Studio 2010

I am currently trying to integrate typescript into vs 2010 by following these instructions for windows 7 described here.
Please do not mark this as duplicate because I am having a problem with the provided solution to my question and cannot comment on the solution.
I followed your instructions closely but sadly it's not working for me. During installation of typescript I get an warning from VisualStudio concerning devenv.exe: Invalid Command Line. Unknown Switch : updateConfiguration.
After clicking okay the installer reports that the installation was successful. when I start VS without creating or opening a project, after a while I am greeted with another error:
Confirming, that I do not want to get bugged about this again i create a new typescript(!) project, which gets denied with a more severe notification:
I checked all the folder paths I added as parameters to the .msi file and it looks like everything is in place. Any ideas how to resolve this?
Thanks!
I suppose there is a missing folder redirection in the answer you referenced, the VSTools msbuild folder is not being redirected.
If you open up the %programfiles%\msbuild\Microsoft\VisualStudio\v11.0\Typescript folder, is the target file present there? Try copying the whole folder to %programfiles%\msbuild\Microsoft\VisualStudio\v10.0\Typescript.
On a more serious note, Typescript is usually used for Web Development, Web development project types are almost 100% backwards compatible between VS2012, VS2013 and VS2010, so why not upgrade to make use of these features.
It can hardly be a support issue, since backhacking Typescript into VS2010 is surely putting you in the unsupported bucket.

Notorious Visual Studio Error C1902, VS configuration

I am getting the notorious "Error C1902: Program database manager mismatch; please check your installation" in my VC++ builds in Visual Studio 2010. My VS will not even build hello world, there is no pdb file even in existence in the folder.
Steps I have tried:
cleaning and rebuilding (3 different projects including hello world, about 15 times)
removing every single instance of Visual Studio before version 2010 from the computer including all redistributables. There is no copy of mspdb*.dll on my computer anywhere except the latest version (100) in my 2010 directory.
Reinstalling 2010. I completely reinstalled VS 2010. No effect.
Rebooting my computer. I have spent the afternoon deleting anything that might be remotely related to this bug and rebooting over and over again.
I solved the problem by finding an obscure post to a similar thread created a couple of years ago on a different forum. Here is the solution:
Copy the file mspdbsrv.exe from the VisualStudio/Common7/IDE directory to the /VC/bin directory.
cyglas-config solved the problem on my build system. Is seems that Vs2010+ needs this but vs2008 didnt.
I have seen this caused by two projects sharing an intermediate directory.
Make your your VS2010 is running under administrator and have the right permission.
Our IT deployed a tool for blocking access to several "ports", it turned out all my VC project cannot build in VS2010. He then re-deployed the tool with "allow elevated program access blocked 'ports'" checked and everything is back to normal.
Verify local user account if ran under automation is not locked. this turned out to be a resolution for issue I had seen with "fatal error C1902: Program database manager mismatch; please check your installation" message.
I had the same error, and the problem was that the "mspdbcore.dll" file was deleted from my \Microsoft Visual Studio 12.0\Common7\IDE\ folder. This post helped me solving my issue.
PS:The deletion was made by a "duplicate files cleaner" utility.

visual studio: unable to delete folder this function is not supported on this system

Appparantly I'm the only one on the Internet experiencing this problem because I can find ZERO other reports of anyone else encountering it. Unfortunately I've been dealing with it for months and I don't know what else to do.
sometimes when I attempt to delete a folder from visual studio 2010, I get the error
unable to delete folder 'XXXX' this function is not supported on this
system
I can't delete it from the file system either unless I reboot the machine. Apparently there is a lock on it somewhere, but I can't find it. I tried to use Unlocker, but that doesn't work on Windows 7 x64 so I'm stuck.
This happens most often with the App_Theme folder, though it happens with other folders as well.
I would suspect it has something to do with source control (we are using sourcegear fortress), however I've encountered this error at home on my personal projects, and I don't use source control on that...
so does anyone have any ideas? has anyone out there experienced this issue? please help, it's driving me quickly and certainly towards insanity.
same thing to me here, what i am doing to fix that is to delete that file or folder from the file system and after that delete it from visual studio.
This is happened to me because previously I opened file in browser to see what is the content. Probably IIS locked files under this folder so it does not let you delete them.
Do iisreset and try again, it will release lock and you can delete it from visual studio.
You are probably trying to delete a file in a folder for which you don't have permission. Try to move your files to another folder or run Visual Studio as administrator.
This may happen if you do not have folder permissions within windows itself. Give the user folder permissions (full control) for the folder containing the solution and make sure those permissions are inherited by children of the folder. Once that is done (in the case of one of our employees) folders can be deleted from within visual studio.

Resources