Cannot convert vcproj in VS2005 to vcxproj in 2010 - c++

I try to convert vcprojs from 2005 to 2010 and I get the following error:
Converting project file 'C:\temp\Win32GlobAgent\Win32GlobAgent.vcproj'. Unable to read the project file "Win32GlobAgent.vcxproj". C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(36,5): The expression "[System.IO.Path]::Combine(C:\temp\Win32GlobAgent\, "C:\temp\Win32GlobAgent\"/bin\Win32GlobAgent.dll)" cannot be evaluated. Illegal characters in path.
I need help on this.
I tried also to first convert to 2008 and then to 2010 but did not help.
Thanks

"C:\temp\Win32GlobAgent\"/bin\Win32GlobAgent.dll
Pretty clear from the error message, it is tripping on the double quote that's inside the string instead of the end. Which was probably caused by the forward slash on /bin.
Search the .vcproj files for /bin and use a text editor to correct to \bin or bin. Notepad will do fine.

There are no illegal symbols per se in the new vcxproj file. However quotes in text elements are handled differently in VS2013/VS2012. They were fine in the past but now cause the error reported. To fix the problem just edit manually vcxproj file as Hans Passant suggested.
For example, change this
<Midl Include="doc.idl">
<TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"..\Lib\lib.tlb"</TypeLibraryName>
...
</Midl>
to this (notice quotes around ..\Lib\lib.tlb are removed:
<Midl Include="doc.idl">
<TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\Lib\lib.tlb</TypeLibraryName>
...
</Midl>
Repeat this step for all the other elements inside Midl element.

Related

Error on loading an existing project in Visual Studio 2008

When trying to load an existing project on Visual Studio 2008 Service Pack 1 I get the following error
The following error has occurred during XML parsing:
File: C:\pathTo.vcproj
Line: 49501
Column: 6
Error Message:
System error: -2147154682
The line where it fails is on a moc file that doesn't exists because as a moc file it will get generated during the build. The weird thing is that there are several moc files in other projects but not all of them fail to load only certain ones.
Thanks to Anon Mail's comment, I figured out what was needed.
I am not providing a full explanation of the answer because I don't fully understand the black magic behind it but here's what I did to fix my problem:
Make a copy of the incriminated .vcproj file :)
Manually change the .vcproj file and remove all the files (in my case all the mocs) that fails to load as Anon Mail suggested.
The project should then be loaded correctly
Once loaded close Visual Studio and restore the previous .vcproj file
Open up your solution and it should be fine.
Again, I don't really understand why it works this way but I hope this may help someone else in the future.

The desired name for <file> is invalid - visual studio 2015

This is pretty crazy, I am only adding an existing .h file to VS2015 C++ project but it would complain:
The desired name for c:\code\usbview\USBdevices.h is invalid
I was able to add this file to project when it had its own .sln file. However, I created a new empty .sln file and wanted to add this and other project and that's how this issue kicked in. It wouldn't add this project to new solution giving a similar weird error about the files I added.
I then add the base project to that solution file and tried to add this .h and .cpp files there but it adds the .cpp but gives this error for .h file.
This is very weird, I changed the files names but the same error.
The link in the comment section by BlackDwarf fixed the problem even though that was was for C# but applies.
I didn't have USERPROFILE environment variable so I created it and set it to c:\Users\my.name and now I can add the file
I had the same problem and it was because of merge errors in the file ProjectName.vcxproj.filters.
The answers here led me to check my vcxproj when I experienced the OP's problem.
It turns out I had two filters with the same name in my Project.vcxproj.filters, something like
<Project>
<Common>
...
...
<Stuff>
<Common>
And I was trying to add files to the second Common.
To fix it, I had to ..
edit the vcxproj manually in {favoured text editor} and remove the second filter I'd added with a duplicate name.
Unload/Reload the project from the solution in VS(2017), and add a filter with a unique name. All good - I can add files to my new filter.
I use VS 2013 Express and had the same error.
Solved by removing VCTargetsPath environment variable, I added it some time ago, don't remember why :)
I had the same issue, but the solution had nothing to do with "Environment Variables" for me. What I did: Close Visual Studio 2017. Reopen my project. Suddenly I had two copies of the "Helper.cpp" and "Helper.h" that I was trying to add already as part of the solution files. Clicking on each I saw that one of the files was invalid, probably because I had deleted that version of the file in that file location. I deleted the invalid files, checked to make sure that the files had the correct code I wanted in them, built the solution and everything ran fine.
Not sure why closing and reopening VS fixed the problem, but glad it did.
If the environment variable route doesn't work for you, check the integrity of your project file next.
I had this problem in 2017, and it was due to a double entry in the vcxproj from a manual editing error. Our vcxproj file had the following in it:
<ClInclude Include="XXXX.h" />
<ClCompile Include="XXXX.h" />
In 2017 we got exactly the error you described when trying to add an existing file, a slightly different one when adding new, and strange crashes elsewhere. Opening the solution in 2015 logged the exact problem and failed to load the project. We removed the double entry and all the mysterious problems vanished.

Command line error D8036 - not allowed with multiple source files

I was working in visual studio, and I made a few changes to one of my projects (changed a few include directories). When I tried to build that project later on I got the following error message:
cl : Command line error D8036: '/Fo.\obj\ms100_r' not allowed with multiple source files
I don't see how that is relevant to what I changed at all. I even rolled my .vcxproj file back to the previous version and that error still persists. I am clueless as to what is causing it. Aren't command line parameters supposed to be managed by visual studio anyway?
had the same problem and realized i had removed the slash at the end of:
configuration properties->c/c++->output files->object file name->
once i added back the slash at the end of the file name, everything worked again
I had a similar error with /doc. For me the solution was to change Configuration Properties / C/C++ / Output Files | XML Documentation File Name from "$(TargetPath).xml" to empty string.
this error due invalid setting in project Browse information .
goto configuration > C/C++ > Browse information > Enable Browse Information to None
A twisted variation on the selected answer is if you use quotes around pathname. The backslash must be the last character.
So:
/Fa"\base\some dir\" will fail
/Fa"\base\some dir"\ will work

vc++ compile error RC : fatal error RC1107: invalid usage; use RC /? for

I am getting following error while building my vc++ project (Using visual studio 2010)
RC : fatal error RC1107: invalid usage; use RC /? for
I know there is some issue while building resources but how to get the exact problem area?
Thanks
Solution:
Add a slash to the last include path will do the trick.
If your last include path already contain a slash at the end, delete it will also work.
Note: Some other include paths can cause this too; it doesn't have to be the very last include path. In particular, check the last include path that you add (in addition to the built-in ones) in your project/properties file.
I had a similar problem. I solved it removing the trailing backslash from the last path in Include Directories (from Project Properties | Configuration Properties | VC++ Directories).
I got this when upgrading from VS2008 to VS2010. None of the suggested solutions worked for me.
What worked for me was deleting all the files in the configuration build folder (e.g. Release) and rebuilding the solution.
I also solved this problem by removing VS include path "\" from last entry.
My solution for VS2010:
click menu "Project","Properties" to open Property pages.
click "Configuration properties", "general" to change Output Directory from "$(Configuration)\ \" to "$(Configuration)\" ,change interminably directory from "$(SolutionDir)$(Configuration)\ \" to "$(SolutionDir)$(Configuration)\".recompile and it's OK.
I experienced that both with VS2015 and VS2017 .
Pls look in 1, at the answer of AH214.
In some cases the Resource Compiler fails to understand the options of the RC command line created by Visual Studio .
To find the problematic option do:
In VS2015, as described by AH214, copy the command line options listed in Project -> properties -> Configuration Properties -> Resources -> Command Line .
Find some *.rc file on your machine.
Open Visual Studio command prompt.
Issue the command
RC [the options copied in (1)] [the path to the rc file in (2)] .
You should get the same RC1107 error.
Check in this property page the contents of ...Resources -> All
Options . Look for a suspicious option and fix or remove it.
Repeat (4) and (5) till you do not get the RC1107 error in (4).
Once you found the culprit, check if you can change it or even remove
it.
I had this issue with VS 2017. The problem was that I did not notice that I had the build configuration set to Release and there was a string in one of the controls that was too long and needed to be truncated by the resource editor when the resources were loaded. Putting the build configuration back to Debug and attempting to open the Resource file fixed it. I got a different message this time: string too long - truncated, and the resources could be viewed now.
the backslash trick didnt work for me. but i just added a new icon to the RC file and then it worked all fine for me.

vs2005 general error C10100b1(C++)

I'm ready to release my *.exe and set the release build in virtual studio 2005, but I got a error like that:
mt.exe: failed to load file "..\release\hasm.exe" {_~0 BEL SUB EOT BEL v STX
the BOLD string with 3-characters are symbol that can not print in plain text, and I can't copy them from my working conputer, but I edited them in Notepad++, and I can see them, now I typed them in "plain" text(and ther is no space(' ') between them) and I hope you can emagin their shape.
the trick is that, I can compile my debug-edition and the *.exe works well, I have tried other project and used the same encoding and there is nothing happened -- everything goes well with the debug and release.
I think there was some unicode in the code(some comments are Chinese), but the compiler should not stand along with the code, there must be a syntax error or something else. Now, it's not a syntax error or a link error, is there any other possibilities---I mean in my code? and what exactly the mt.exe doing?
ps: I have seached for all my code, there is no "{_~" in my (C++)code, FML...
My guess is that the project settings for release got broken somehow. Compare all settings between the debug and release configs. If you can't find anything, it's probably something internal in the project. The best way to fix that is to create a new project in the same solution and add all your source files to it.
Hope this helps.
Cheers,
Sebastiaan