新的自定义规则中的“输出"属性 [英] 'Outputs' property in new custom rules

查看:72
本文介绍了新的自定义规则中的“输出"属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

Hello.

我正在基于vcproj文件设置创建一个新的c项目类型.

I'm creating a new c project type based on vcproj file settings.

(我正在使用Visual Studio 2005 Professional评估版和Visual Studio 2005 SDK.)

(I'm using Visual Studio 2005 Professional evaluation and Visual Studio 2005 SDK.)

我制作了一个.vcproj项目文件,该文件将被复制到新类型的每个新项目目录中.

I made a .vcproj project file which is to be copied into every new project directories of the new type.

我为我的新项目制作了一个新的自定义规则文件,它看起来像这样:

I made a new custom rule file for my new project, and it it looks like this:

<?xml version ="1.0" encoding ="utf-8"?
< VisualStudioToolFile
Name ="My Compiler" <版本> Version ="8.00"
< < Rules>
< CustomBuildRule
Name =我的编译器"
DisplayName ="My Compiler"
CommandLine ="d:\ mycompiler.exe [inputs]"
$(Intdir)\ $(InputName).obj''quot;
FileExtensions =``* .c''
ExecutionDescription =''My Compiler'' /Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFille>

<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
 Name="My Compiler"
 Version="8.00"
 >
 <Rules>
  <CustomBuildRule
   Name="My Compiler"
   DisplayName="My Compiler"
   CommandLine="d:\mycompiler.exe [inputs]"
   Outputs="$(Intdir)\$(InputName).obj"
   FileExtensions="*.c"
   ExecutionDescription="My Compiler"
   >
   <Properties>
   </Properties>
  </CustomBuildRule>
 </Rules>
</VisualStudioToolFille>

问题是这一行:

Outputs ="$(Inddir)\ $(InputName).obj"
当我关闭Visual Studio实验性配置单元并从中删除文件时,Visual Studio崩溃.

 Outputs="$(Intdir)\$(InputName).obj"
Visual Studio gets crashes when I close the Visual Studio experimental hive, delete a file from

我的新项目,依此类推.但是,如果我将输出属性指定为另一扩展名,

my new project, and so on. But if I specify the extension of that Output propery to a different one,

例如,"$(Inddir)\ $(InputName).ob",就可以了.或即使扩展名为.obj,

say, "$(Intdir)\$(InputName).ob", it's OK. Or even if the extension if .obj,

输出=" abc.obj"

 Outputs="abc.obj"

没问题. (abc是一种随机生成的名称;没有文件abc.c或abc.obj.)

causes no problem. (abc is a kind of randomly generated name; there is no file abc.c or abc.obj.)

自定义规则文件中的输出"属性的格式是否受到限制?

Is there any restrictions on the format of 'Outputs' property in a custom rules file?

我已经搜索了msdn中的文档,但没有找到帮助.

I've searched documents in msdn, but I found no help.

谢谢您的帮助.

推荐答案

"nyam",

是的,对输出有限制.两个动作不能产生相同的文件.如果编译器从foo.cpp获取输入并创建foo.obj的输出,则没有其他工具可以创建foo.obj的输出. (尽管两个文件名的路径不同,但它们可以相同.)解决方法是为自定义生成规则使用不同的文件名或不同的路径.另外,我认为您不必指定任何输出."

此致,
Aaron
Hi "nyam",

Rocky from the C++ team had this to say:

"Yes there is a restriction on outputs. Two actions cannot produce the same file. If the compiler gets an input from foo.cpp and creates output of foo.obj, then no other tool can create an output of foo.obj. (although two file names can be the same if their paths are different.) The workaround for this is to use different filenames or different paths for the custom build rule. Also, I do not think you have to specify any output."

Sincerely,
Aaron


这篇关于新的自定义规则中的“输出"属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆