VS2010 error : LNK1181 : cannot open input file xxxx.obj (only in debug mode) - visual-studio-2010

I am using visual Studio 2010, trying to build a big solution having many VC++ projects converted from older Visual Studio builds.
The problem is, it gives me this LNK1181 for the 'root' project of the solution (the project on which all other projects are dependent) but only in DEBUG mode (win32). In release mode, it does not give me this error.
I noticed that this obj file is actually not created at all when in debug mode. Though the compiler doesn't give any error when it is building that cpp file.
What could be the problem? Is it related to those property manager sheets too somehow or something else?
The project is downloaded from our Source Control System directly, and works fine on other machines so there is something wrong on mine :(.

Click on solution.
goto Build menu and clean the solution and again build the solution hopefully this action sove your issue

You probably solved this a long time ago, but when I had this exact issue, removing the source files used to create the object from the project and then re-adding them as existing items fixed the issue. Of course, this doesn't change the fact that you're using project/solution files from your repo that other people are using without issue, which is odd.

For what it's worth, I had accidentally added *.obj files to the project, and so it was throwing this error.

Related

"The project file was unloaded" when moving VS2010 project to another server

I have moved a Visual Studio 2010 project to another server by copying and pasting the folder contents into another folder on a different server.
My understand was that VS2010 handled this well; when I have done this locally it has never been an issue.
Now I get an error like this:
When I right click and "Reload project", the list of files briefly appears before disappearing again, giving the original error.
Am I doing something wrong?
I experienced the same problem today. Here is what I did and worked for me :
Open the .sln file.
Right click on the project folder and click Reload project.
You will see the projects and folders that you originally had.
You will see .xml publish file . Double click it .. You should be good to go now.
I had this problem today and it took me a while to figure out what was going on.
Your problem is most likely that your solution was originally made with a Visual Studio configuration that contained support for certain project types (such as "Windows Service" or some other exotic project type). The Visual Studio configuration you are using to import your solution does not have that support. In other words,
there is probably nothing wrong with your solution,
there is probably nothing wrong with your project,
there is probably nothing wrong with any of the files (as you mentioned they do display briefly, giving you a second of hope)
Just run the installer on the new Visual Studio and make sure the support is enabled for all the project types you need and try again.
In my case the problem was the .vbproj file had somehow been corrupted so the normal xml code was replaced with a long string of null characters. I noticed this thanks to a file that was generated in the same folder as the project file when I tried to open the project - it was called 'UpgradeLog.htm'. This had an entry saying ' Error on line 1. Expected '<' but found 'null character'.'.. suggests there may have been a recent update to Visual Studio that I hadn't noticed?
Luckily I could use my source control system to revert back to a slightly earlier version - I guess it shows how important it is to have backups!
In my case, I saw similar message (Projected was unloaded) and all I had to do was simply re-launching Visual Studio (2017) in Admin mode and the problem went away. Per one of the above answers, I tried to right-click and selected Reload but got a warning that, due to required access to IIS on the machine, I had to launch VS in Admin mode.
HTH
Found this answer and it worked for me.
Note:Sometimes, the path in File path property is grayed out and you are unable to get to the Browse button. In this case try deleting .suo files. Don’t worry, these files gets recreated when you rebuild the solution / project.
http://www.howtosolutions.net/2013/02/solving-project-file-error-could-not-find-part-of-the-path-with-visual-studio/
I had the same problem. I fix path to .csproj files in the .sln file with a text editor and now it is all ok.
Open Visual Studio as Administrator

Namespace not found within the same project according to intellisense, yet project builds

I have a simple ASP.Net MVC project which for some reason has issues with intellisense. It is constantly giving me errors that namespaces local to the project can not be found, even though they do exist and the project will build fine. Here's an example:
It is very frustrating as this results in me having no intellisense available whatsoever. Has any one encountered a problem like this before, and do they know of a solution?
The project itself is an MVC4 website running in VS2013 in W8 under Paralells on a Macbook Air, should that have any effect on the problem.
As stated, I have no error messages to provide as the project builds and runs successfully, but please let me know if more details are required.
I had the same issue. Try removing your project from the solution and then add it again. It worked for me. Looks like a solution file quirk.
UPDATE: this is not a permanent fix as closing and reopening visual studio brings back the issue.
UPDATE 2: while looking to fix another issue where I couldn't change the default namespace of a project (I would get a System.Runtime.InteropServices.ExternalException), I found out that it was related to Xamarin tools for Visual Studio. I proceeded to completely uninstall Xamarin. It fixed my namespace renaming issue as well as the weird type or namespace not found / intellisense issue.
I had this same issue, seems to be something with the solution file and building the project as I could replicate the problem by simply creating a new project building then restarting visual studio.
Anyway I get around it at the moment by deleting the solution file and opening the project using the project file.
For anyone reading this in 2020, a fix that I've found that has worked for me is:
cleaning the solution and unloading the projects that have dependencies such as a web API depending on a data project and an application project (right click on the project in solution explorer and find "Unload Project"),
then reloading and building each project in the order of dependence such that they build successfully (right click on the unloaded project in solution explorer and find "Reload Project").
so in my case my data project does not depend on any other project so I reloaded and built that first, then the application project which depends on the data project and finally the web API project which depended on both data and application.

Dotfuscator 4.10 project in VS 2012 bugs while trying to save .dotfuproj file

I recently installed Dotfuscator 4.10 on my computer and I already has VS 2012 working on it. Everything worked fine up to the point when I tried Dotfuscator embedded in VS (I mean the standalone GUI app works perfectly).
Just for the try, I created a small solution (no TFS/VSS) with a C++ /clr app, a C++/clr dll and a C# app.
I then added a Dotfuscator project. To this project I added the output from the three dll/exe other projects.
When I tried to rebuild the solution, I was asked to save the .dotfuproj file. Strange and abnormal behaviour, the file should be saved automatically and without prompting me. OK, I chose to overwrite the existing file (what should have been done automatically after all.) I got the error Object reference not set to an instance of an object. I had to cancel the operation and could not build the solution.
Note that I observed the same behaviour if I tried to save the dotfuproj file under an other name. Also, the file is not R/O.
My question: has someone experienced this problem? Any solution? Thanks for your help!
You can try deleting your Dotfuscator project and then creating a new project. If that does not work, try using direct input to the Dotfuscator project, rather than using the output of another project within your solution.

The working directory does not exist in Visual Studio 2010

I am using Visual Studio 2010.
I wanted to study some code that dumps relevant data in a database, find out how it works and adapt it to my own version.
I only got as far as loading the solution in VS 2010, hitting the "Start Debugging" button, and then I got this error:
The working directory does not exist:
'D:\Dev\CodeProject\articles\smartcardfmwk\Smartcard_Framework
How can I fix this error?
The source code in question is Smart Card Framework, from Code Project
I downloaded the "Updated Project (VS2010)" and I can open it in VS2010, as well as build, but debugging just wouldn't work.
I did not try replicating the path yet, but as this is a working project, my company requires that it is placed on a very specific location accessible by others.
Nevermind, I got it. It was so simple, I'm sorry for wasting anyone's time.
The source Solution had a lot of Projects under them. I figured at least one of them was pointing to a directory that doesn't exist, so I waded through the Projects,
I right-clicked a Project and clicked the Properties
This will open up the ProjectName Property Tab
Under the Debug tab, there is a filed called "Working Directory"; I changed it to where the project is currently located.
This solved my problem, for now, unless there's a Project I missed. I am wondering, though, if I have to do this again if I move the Solution elsewhere.
This happened also in VS 2019 after importing / upgrading an old C# project. I was not able to see any project properties to change.
Finally it was fixed by manually editing the file <ProjName>.user.csproj as follows:
Replace
<StartWorkingDirectory>[wrong directory name]</StartWorkingDirectory>
with
<StartWorkingDirectory>.\</StartWorkingDirectory>
I also faced this problem that working directory does not exist, but I managed to solve it. There are certain steps to follow properly Whenever this error occurs.
In VS, open the "Project" at Toolbar.
Then go for Project properties.
Select Debug And check your working directory. If the path is wrong just browse it...

Visual Studio 2010 F5 Debugging C++ is not Rebuilding

I have a Visual Studio 2010 Ultimate C++ project (not managed or .NET). When I press F5 (i.e., start debugging), I want it to save all the files, rebuild those that changed, link the whole thing, and then run. Instead, it appears to use the last build. Thus, when I try to step into a function or something, I get the following error:
Based on my research, I have verified these options, the first three of which are in the Options dialog (can be reached under "Debug->Options and Settings"):
"Projects and Solutions->Build and Run->Only build startup projects and dependencies on Run" is checked. Some research indicated that it should be unchecked, but in my case I actually do only want it to rebuild the startup project. For what it's worth, I've tried unchecking it, with no effect.
"Projects and Solutions->Build and Run->On Run, when projects are out of date:" is set to "Always build".
"Debugging->Edit and Continue->Enable Edit and Continue" is checked, though it's greyed out.
In the Configuration Manager ("Build->Configuration Manager"), all solution configurations and platforms have their "Build" checkbox checked.
I have also tried deleting all Debug and Release directories as well as the .sdf and ipch directory.
For completeness, I suppose I should mention that I'm using precompiled headers, though I kinda doubt it matters.
[EDIT: I should note that it only seems to be one file (a .h file) that's doing it. I tried renaming it and recompiling, and also removing it from the solution and adding it back in, but it didn't work. ]
I was able to bring my solution back into the right state after deleting all .suo and .csproj.user files. Answer led to this solution. Hope this saves someone time.
I fell into this state after installing Ultimate over Professional and running profiling tools.
Once I had similar problem with my C# project and I think I have tried every possible suggestion available on internet but none worked and then this is what I have done:
Created an empty Project
Added startup function to verify that it does not show any error
Imported all my source code manually one by one
So, Yes, it was the solution. You already have done a lot so I would say you can get lucky by trying here and there however having a new project and importing your individual source file would be faster.
Another solution could be that switching the platform. I noticed that when I when to project properties, the new project I had just created had a platform of 'win32' and my other projects in the same solution had it set at x64. After I switched my project to x64, everything worked just fine. This worked for my interop(C,C+, C#) project and hopefully works for other projects as well.
I have successfully resolved it, try the following:
remove all temporary and intellisense files
remove all project from solution and then add them back(most important)
check projects 'Frameworks and References' to ensure they are valid

Resources