【发布时间】:2012-11-16 17:03:37
【问题描述】:
下面的main想通过msbuild编译
#include <stdio.h>
int main (int argc, char *argv[])
{
char Buffer[2000];
printf("TEST");
gets(Buffer);
}
批处理文件调用 msbuild:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild main.vcxproj
pause
msbuild工程文件如下。
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ItemGroup>
<ClCompile Include="main.c" />
</ItemGroup>
</Project>
到目前为止,整个设置工作正常,但我需要找到一个好的资源来帮助我了解有关 msproject 文件的更多信息。 我想学习很多东西。我该怎么做:
- 去掉“导入”选项,自己定义导入的部分
- 使用命令行参数编译一组文件...( %param%.c %param%TEST.c ,...)
- 使用项目文件立即启动程序 (%param%Test.exe)
- 编译多个目标,...发布、调试等
- 编译后拷贝:Subproject/release/%param%.obj -> c:\accurateVersion\%param%.obj
- 重建前清理
【问题讨论】:
标签: msbuild ansi c89 projects-and-solutions