首页 新闻 赞助 找找看

请问下OrchardCore是如何做到Package.Build.props隐射到各个模块项目的?

0
[已解决问题] 解决于 2020-06-15 16:26

OrchardCore.Module.Targets项目的Package.Build.props(这个项目文件夹有这个文件)映射到各个模块项目(文件夹里并没有这个文件),visual studio都会显示
这里好像涉汲nuget包管理,好像是通过yml管理那种很多项目的nuget包吧,这种相关资料我还没接触过,我只接触过yml配置文件管理docker

shuisen的主页 shuisen | 菜鸟二级 | 园豆:205
提问于:2020-06-12 10:22
< >
分享
最佳答案
0

Project("{x1}") = "Global", "Global", "{x2}"
ProjectSection(SolutionItems) = preProject
Package.Build.props = Package.Build.props
EndProjectSection
EndProject

解决方案文件,研究下

奖励园豆:5
舟翅桐 | 小虾三级 |园豆:675 | 2020-06-12 10:37

找不到,会不会跟yml配置有关,是否是通过变量放进去解决方案文件,我研究看看,多谢提供了个思路

shuisen | 园豆:205 (菜鸟二级) | 2020-06-12 11:13

@shuisen:

<ItemGroup>
<Compile Include="..\xxx.prop">
<Link>xxx.prop</Link>
</Compile>
</ItemGroup>
csproj文件中通过这种方式添加试试

舟翅桐 | 园豆:675 (小虾三级) | 2020-06-12 13:46

@不会Redis: 这个也没有,你上面那种思路应该是对的,就是不熟悉yml文件,我估计是yml生成你上面的编码,看来得学下yml

shuisen | 园豆:205 (菜鸟二级) | 2020-06-12 14:16

@shuisen: 《This file is packaged with "OrchardCore.Module.Targets.nupkg" in "./build" such that any
Module that references it will embed in its assembly all assets files and mapping infos.
Here we use some msbuild properties that would not be evaluated in the .props file.
It also prevents VS from adding / keeping some unnecessary lines in the project file.》
被引用的xxx.Target项目自身在编译的时候会通过msbuild的相关方法将其目录下的.props文件引用进去

舟翅桐 | 园豆:675 (小虾三级) | 2020-06-12 14:30

@不会Redis: 这道理我懂啊,关键是visual studio不是解析sln进行类似msbuild的编译吗,我觉得很神奇就是OrchardCore.Module.Targets项目里的Package.Build.props居然可以映射到所有模块项目里面,每个模块项目在visual studio都能显示出OrchardCore.Module.Targets的Package.Build.props文件,而每个模块项目实际却没有这个文件(只是映射,我的理解)

shuisen | 园豆:205 (菜鸟二级) | 2020-06-12 15:16

@不会Redis: 找到原因了,OrchardCore等等源码文件下有个Directory.Build.props和Directory.Build.targets,根据MSBuild 15.0以后版本会默认加载,然后这个Directory.Build.props多重导入中就有上文的那个props,没研究过MSBuild真是难看懂!

shuisen | 园豆:205 (菜鸟二级) | 2020-06-15 16:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册