I just installed visual studio, (not new to coding) and I keep getting an error that goes like «error: unable to open file C:user…main.obj Error code = 0x80070002»
an Image of the error
this error shows up whenever there is something wrong with my code like for example if i do:
#include <iostream>
int main()
{
std::cout << "Hello World!n";
}
everything runs normal, but if I make a mistake say:
#include <iostream>
int main()
{
std::cout std::cout << "Hello World!n";
}
I get the error, it’s so annoying I don’t want to get that error every time there is something wrong with my code the error list bar is enough, what do I do ?
asked Mar 26, 2020 at 12:50
4
Could you please tell us what version of Visual Studio are you using?
If you are using vs2017 or later, I suggest you could try to use /DEBUG:FULL
property in «Linker/Debugging/Generate Debug Info.
I suggest you could refer to the Doc:
When you specify /DEBUG with no additional options, the linker
defaults to/DEBUG:FULL
for command line and make file builds, for
release builds in the Visual Studio IDE, and for both debug and
release builds in Visual Studio 2015 and earlier versions. Beginning
in Visual Studio 2017, the build system in the IDE defaults to
/DEBUG:FASTLINK
when you specify the /DEBUG option for debug builds.
Other defaults are unchanged to maintain backward compatibility.
answered Mar 27, 2020 at 2:32
Jeaninez — MSFTJeaninez — MSFT
2,4321 gold badge4 silver badges18 bronze badges
Rebuild the program in a different disk or reinstall the VS could be the final solution I think.
answered Mar 27, 2020 at 2:37
ChrisChris
2291 silver badge8 bronze badges
Hi KurtChin,
If this issue happen only when you are creating ASP.NET Web apps, but other projects work fine.
The ASP.NET templates could be broken, in order to fix this issue, I suggest you to try devenv switch in command prompt, please follow the steps below (I’m using vs2015):
- Open Windows Explorer, and navigate to <Visual Studio Installation Path>Common7IDE (by default is <C:Program Files Microsoft Visual Studio 14.0Common7IDE>);
- Delete the ItemTemplatesCache, ProjectTemplatesCache folder;
- Open Visual Studio Command Prompt (2015): Start menu ->
All Programs -> Microsoft Visual Studio 2015 ->
Developer Command Prompt for VS2015 (run it with Administrator privilege: right-click the program ->
Run as administrator); - Run the devenv /InstallVSTemplates switch;
- Run the devenv /Setup switch
If this issue also happen when you are creating other projects, please try to manually repair it.
Please go to control panel, choose vs2015 right click “repair”.
I also found a similar issue as yours which happened in VS2013, you might refer to it.
It’s said this error could be caused by your NuGet Package Manager incorrect installation.
The link is here for you to refer:
http://stackoverflow.com/questions/18984639/exception-hresult-080070002-while-creating-an-mvc-application
If this issue still exists after all steps above, please check the ActiveLog.xml.
This file appears after you’ve called devenv /log in
Developer Command Prompt for VS2015. By default, the log file is:
%APPDATA%MicrosoftVisualStudioVersionActivityLog.xml
This file will log all operations when you operate Visual Studio which has some information for troubleshooting. Please try it and share it with us.
Best regards,
Fletcher
MSDN Community Support
Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.
-
Marked as answer by
Wednesday, December 28, 2016 2:58 PM
- Remove From My Forums
-
Question
-
I am getting error on creating even the empty web application project. The error message is as given below:
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
I am using following build of Visual Studio:
Visual Studio Professional 2013. Version 12.0.30723.00 Update 3
Looks like it is the problem with the installation of the visual studio. But I can’t take risk of re-installing now because it would stop my going on development work.
Any would help to resolve this would be appreciated.
P.S. I am also having Visual Studio 2010 and Visual Studio 2012 Ultimate on my system.
Regards, Randeep
Answers
-
Hello Randeep,
Will you get the same error when creating any other apps, like C# WinForm?
If only web application project has the problem, you can try the following to reset the templates:
- Please open Windows Explorer, and navigate to <Visual Studio Installation Path>Common7IDE (by default is C:Program Files Microsoft Visual Studio 12.0Common7IDE);
- Delete the ItemTemplatesCache, ProjectTemplatesCache folder;
- Open Visual Studio Tools/Developer Command Prompt for VS2013
under Start menu -> All Programs -> Microsoft Visual Studio 2013 -> Visual Studio Tools (run it with Administrator privilege: right-click the program -> Run as administrator); - Run the devenv /InstallVSTemplates switch;
- Run the devenv /Setup switch
If all your projects get this error, please try repair the installaiton from control panel first. By the way, can you use Visual Studio Web projects before you get this error? And have you tried to use the Visual Studio Update 4, I see you still used
Update 3, is there any reason for you to still use the Update 3 version?Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.-
Marked as answer by
Thursday, April 9, 2015 11:49 AM
- Remove From My Forums
-
Question
-
I am getting error on creating even the empty web application project. The error message is as given below:
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
I am using following build of Visual Studio:
Visual Studio Professional 2013. Version 12.0.30723.00 Update 3
Looks like it is the problem with the installation of the visual studio. But I can’t take risk of re-installing now because it would stop my going on development work.
Any would help to resolve this would be appreciated.
P.S. I am also having Visual Studio 2010 and Visual Studio 2012 Ultimate on my system.
Regards, Randeep
Answers
-
Hello Randeep,
Will you get the same error when creating any other apps, like C# WinForm?
If only web application project has the problem, you can try the following to reset the templates:
- Please open Windows Explorer, and navigate to <Visual Studio Installation Path>Common7IDE (by default is C:Program Files Microsoft Visual Studio 12.0Common7IDE);
- Delete the ItemTemplatesCache, ProjectTemplatesCache folder;
- Open Visual Studio Tools/Developer Command Prompt for VS2013
under Start menu -> All Programs -> Microsoft Visual Studio 2013 -> Visual Studio Tools (run it with Administrator privilege: right-click the program -> Run as administrator); - Run the devenv /InstallVSTemplates switch;
- Run the devenv /Setup switch
If all your projects get this error, please try repair the installaiton from control panel first. By the way, can you use Visual Studio Web projects before you get this error? And have you tried to use the Visual Studio Update 4, I see you still used
Update 3, is there any reason for you to still use the Update 3 version?Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.-
Marked as answer by
Thursday, April 9, 2015 11:49 AM
- Remove From My Forums
-
Question
-
I have this problem (The system cannot find the file specified. (Exception from HRESULT: 0x80070002)) when create new project on visual studio 2015
-
Edited by
Ashraf alngar
Sunday, March 20, 2016 4:14 PM -
Moved by
Angie Xu
Monday, March 28, 2016 1:28 AM
this is visual studio issue
-
Edited by
All replies
-
Hi Ashraf,
Welcome on MSDN forum.
Could you please provide some details, is it related to BizTalk Server?
This forum is related to Microsoft BizTalk Server related queries. If you issue is not related to BizTalk, please post it on Visual Studio forum to get proper solution.
https://social.msdn.microsoft.com/Forums/en-US/home?category=visualstudio
Thanks,
If my reply is helpful please mark as
Answer or vote as
Helpful.My blog |
Twitter | LinkedInThis post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
-
Solution: Some users had already faced the same issue and Visual Studio 2015 Express Web and had the same problem. Please try below solutions and see if it worked,
- Reinstall Nuget for Visual Studio 2015
- Replace Nuget for Visual Studio 2015 with the former Nuget
- Run Visual Studio as Administrator
- Modify/Delete IISExpress applicationhost.config file
- Reinstall IISExpress
If all above solution not worked then only thing that you need to Repair-install of Visual Studio:
- Press Windows + R
- Enter appwiz.cpl and press Enter
- Right-click the entry «Microsoft Visual Studio Express 2015 for Web» and click «Repair»
Note: This is going to reinstall all packages that you have uninstalled, because you weren’t needing them (eg. Microsoft SQL Server Native Client).
Reference: http://stackoverflow.com/questions/28299341/the-system-can-not-find-the-file-specified-in-visual-studio-exception-from-hres
Thanks,
If my reply is helpful please mark as
Answer or vote as
Helpful.My blog |
Twitter | LinkedInThis post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
-
Proposed as answer by
Weiwei Cai
Monday, March 28, 2016 9:39 AM
-
Thanks for [Kamlesh Kumar]’s help.
Hi Ashraf alngar,
Which version or Visual Studio 2015 are you using? Please install the latest update for VS2015 to check whether it can be fixed. The latest update for VS 2015 current now is Update 1. Please download and install from below link.
https://www.microsoft.com/en-us/download/details.aspx?id=49989
Please try [Kamlesh Kumar]’s steps first to check whether it can fix your problem or not. If the problem has been fixed, please mark the helpful reply as answer, which is benefit to other communities who has the same problem.
If the problem still exist, please use http://aka.ms/vscollect to gather the VS and .Net Frameowrk installation logs. After using it, you will find vslogs.cab from %temp% folder. Please upload the file
to Onedrive and share the link here.Best Regards,
Weiwei
Вопрос:
Я пытаюсь создать новый проект в visual studio.it дает некоторую ошибку
пожалуйста, дайте мне несколько предложений…..
Я этого не знаю.
Я пытаюсь переустановить, и снова появляется такая же ошибка.
Я пробую эту работу…
Ответ №1
Попробуйте 1 первый, если не другой
- Перейдите в
Extentions and updates
, затем найдитеNuget
и удалите его,
перезапустите визуальную студию, снова установитеNuget
, затем снова перезапустите.
вы должны иметь возможность создать свой новый проект. - Восстановите свою Visual Studio 2013 или 2015
Ответ №2
Я использую Visual Studio 2015 Express Web и имею ту же проблему. Я много искал для решений, и ни одна из них не работала:
- Переустановите Nuget для Visual Studio 2015
- Замените Nuget для Visual Studio 2015 с прежним Nuget
- Запустить Visual Studio как администратор
- Изменить/Удалить файл IISExpress applicationhost.config
- Переустановите IISExpress
Единственное, что разрешило это: Repair-install Visual Studio:
- Нажмите Windows + R
- Введите
appwiz.cpl
и нажмите Enter - Щелкните правой кнопкой мыши запись “Microsoft Visual Studio Express 2015 для Интернета” и нажмите “Восстановить”
- Будьте терпеливы…
Примечание.. Это приведет к переустановке всех удаленных вами пакетов, поскольку вам не нужны они (например, собственный клиент Microsoft SQL Server).
Ответ №3
Перейдите по ссылке: VS2013- > Инструменты- > Расширения и обновления- > Онлайн-поиск для NuGet и установка. Исправлена проблема в 2013 году REL
Ответ №4
Я столкнулся с аналогичной проблемой при создании основного проекта .NET в VS 2015, и он разрешил восстановление .NET Core. Возможная причина: ядро .NET было установлено, связанное с версией сообщества VS, но позже я удалю сообщество VS и переустановил профессиональную версию, но .NET Core не был удален с удалением версии сообщества. После восстановления ядра .NET с панели управления он работает сейчас.
Ответ №5
Вам нужно установить менеджер пакетов Nuget из Tools- > Extensions and Updates → online- > и найти “Nuget package manager” из панели поиска и нажать “Установить”.
Ответ №6
Решение Андрея Свирида:
Изменение установки Visual Studio 2015 и снятие флажка Microsoft Web Developer Tools
Удаление папки C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsMicrosoftWeb ToolsDNX, оставленной из предыдущей версии инструментов.
Удаление% LocalAppData%MicrosoftVisualStudio14.0ComponentModelCache
Удаление% LocalAppData%MicrosoftVisualStudio14.0devenv.exe.config
Выполнение ремонта инструментария предварительного просмотра.
Ответ №7
У вас есть соответствующие компоненты, установленные вместе с Visual Studio?
Я получал эту ошибку при попытке добавить новый проект Axure Mobile Services. Зная, как долго восстанавливается Visual Studio, я надеялся избежать этого.
Для меня исправлено открытие программ и функций и выбор “Изменить” Visual Studio, а не “Ремонт”.
Я не уверен, была ли ошибка в предыдущей установке, которую я не заметил, но веб-инструменты не были выбраны в установленных компонентах. После выбора этого, установки и перезагрузки моего компьютера, я больше не получаю ошибку при попытке добавить новый проект.
Ответ №8
Я столкнулся с той же проблемой, когда пытаюсь создать веб-приложение ASP.NET MVC 4 в VS 2012.
Чтобы устранить эту проблему В VS 2012 нажмите “Инструменты” (меню) → “Расширения и обновления” (пункт меню) → в окне “Расширения и обновления” нажмите “Обновить”.
Установите ожидающие обновления для VS 2012, а также для Nuget.
Перезапустите VS 2012.
Ответ №9
У меня была такая же ошибка с использованием сообщества VS 2017 (и предыдущего) при попытке открыть файл .cs или попытке открыть свойства проекта.
Все это на новой установке VS на новой установке Windows 10…
Я нашел 2 решения:
Запустите VS как admin (что не является хорошим выбором и может препятствовать отладке drag & drop в ваше приложение).
или лучше:
Измените параметры безопасности вашей папки% temp% на “все – полный контроль”.:)
Ну, я написал простой код, чтобы проверить возможность создания объектов с помощью оператора «new». Когда я пытался скомпилировать код, MS Visual Studio выдавала ошибку примерно так: «Ошибка: невозможно открыть файл C: Users … test1 Debug main.obj. Код ошибки = 0x80070002.Error: Could not find ‘C: Users … test1 Debug main.obj’. test1.exe был собран с / DEBUG: FASTLINK, который требует объектные файлы для отладки.
Что здесь происходит? Пожалуйста помоги.
Код:
#include <iostream>
class czlowiek {
int wiek;
char plec;
czlowiek();
czlowiek(int Wiek, int Plec);
};
czlowiek::czlowiek(int Wiek, int Plec) {
wiek = Wiek;
plec = Plec;
}
int main()
{
czlowiek *first;
first = new czlowiek();
delete first;
std::cin.get();
return 0;
}
0
Решение
Код, который вы разместили, не будет ссылаться:
- Конструктор
czlowiek()
не имеет реализации. - Оба конструктора являются закрытыми (в классах члены и методы по умолчанию закрыты).
В качестве предупреждения вы назначаете int для char (plec).
1
Другие решения
Других решений пока нет …