Build VC++ project with additional cpp file using MSBuild
I need to build VC++ project (made in VS2008) from command line using MSBuild with additional .cpp file which isn't part of this project (doesn't listed in section of 开发者_开发问答.vcproj file. Is there are any way to do this? (e.g. just by passing filename to command line input).
Editing .vcproj file by my script is also is a option but I save it for a worst scenario when there are no way to do it just with MSBuild.
I don't think you can point MSBuild at a project file and tell it to build this project and add another file at the same time. I'd either update the .vcproj file to include the file you're trying to add or go for the script-driven editing approach. Actually, I'd probably just change the .vcproj file as I'd think this is the safer approach and less likely to break something.
You can add the file to the project if it's in the same directory.
If it's shared / in another directory you can try adding as a link.
In the Add / Existing Dialog notice the Arrow on the edge of the add button. Try clicking it.
精彩评论