构建多模块组件
我正在尝试构建一个多模块组件。我有 2 个文件,即 Fraction.cs 和 MyCalc.cs,它们都位于同一命名空间和另一个 AssemblyInfo.cs 中。我不知道如何制作 makefile 文件,所以我从我正在关注的书中复制了一个。 内容
ASSEMBLY= MySharedAssembly.dll
BIN=.\bin
SRC=.
DEST=.\bin
CSC=csc /nologo /debug+ /d:DEBUG /d:TRACE
MODULETARGET=/t:module
LIBTARGET=/t:library
EXETARGET=/t:exe
REFERENCES=System.dll
MODULES=$(DEST)\Fraction.dll $(DEST)\MyCalc.dll
METADATA=$(SRC)\Assemblyinfo.cs
all: $(DEST)\MySharedAssembly.dll
# Assembly metadata placed in the same module as manifest
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST) $(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
# Add MyCalc.dll module to this dependency list
$(DEST)\MyCalc.dll: MyCalc.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
# Add Fraction
$(DEST)\Fraction.dll: Fraction.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
$(DEST)::
!
if !EXISTS($(DEST))
mkdir $(DEST)
!endif
以下是我全部理解的 ,但不熟悉语法。因此,当我尝试运行 nmake 时,出现以下错误
makefile(21) : fatal error v1033: 语法错误: ':' 意外
我假设第 21 行出现问题。请帮助
I am trying to build a multimodule assembly. I have got 2 files namely Fraction.cs and MyCalc.cs and both in the same namespace and another AssemblyInfo.cs. I dont know how to make a makefile file so I copied one from the book I am following. Here are the contents
ASSEMBLY= MySharedAssembly.dll
BIN=.\bin
SRC=.
DEST=.\bin
CSC=csc /nologo /debug+ /d:DEBUG /d:TRACE
MODULETARGET=/t:module
LIBTARGET=/t:library
EXETARGET=/t:exe
REFERENCES=System.dll
MODULES=$(DEST)\Fraction.dll $(DEST)\MyCalc.dll
METADATA=$(SRC)\Assemblyinfo.cs
all: $(DEST)\MySharedAssembly.dll
# Assembly metadata placed in the same module as manifest
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST) $(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
# Add MyCalc.dll module to this dependency list
$(DEST)\MyCalc.dll: MyCalc.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
# Add Fraction
$(DEST)\Fraction.dll: Fraction.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
$(DEST)::
!
if !EXISTS($(DEST))
mkdir $(DEST)
!endif
I understand the whole lot but am not familiar with the syntax. So when I am trying to run nmake I am getting the following error
makefile(21) : fatal error v1033: syntax error: ':' unexpected
I am assuming something is wrong in line 21. please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是不是这条线有问题?
Is this the faulty line?
当我从网上复制粘贴代码时,它终于成功了。它起作用的原因是因为有错误的行已使用返回键分为两行。
$(目标)\$(汇编): $(元数据) $(模块) $(目标)
$(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
It finally worked when I copy paseted the code from the Internet. The reason it worked is because the line that has error has been divided into two lines using the return key.
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST)
$(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s