作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在向我的项目中添加一个自定义 .tt
模板生成目标,以便在 CoreBuild
之前运行,并且似乎有两种方法可以做到:
<Project...>
<Target Name="TransformOnBuild" AfterTargets="BeforeBuild">
</Project>
<Project...>
<Target Name="TransformOnBuild" BeforeTargets="CoreBuild">
</Project>
CoreBuild
之后运行,这为时已晚。还是有什么原因为什么
AfterTargets="BeforeBuild"
仍然可以保证在核心构建之前运行?
BeforeTargets="BeforeBuild"
,它会更早地构建。这是放置`.tt 文本生成目标的更好地方吗?
最佳答案
基于@stjin 的回答,似乎正在使用一个很好的解决方案
BeforeTargets="CoreCompile" DependsOnTargets="PrepareForBuild"
Note that this must run before every invocation of CoreCompile to ensure that all compiler runs see the generated assembly info. There is at least one scenario involving Xaml where CoreCompile is invoked without other potential hooks such as Compile or CoreBuild, etc., so we hook directly on to CoreCompile. Furthermore, we must run after PrepareForBuild to ensure that the intermediate directory has been created.
obj/[TargetFramework]
)是在本例中放置输出
.cs
文件的位置,这也可能是您想要执行的操作。
关于visual-studio - 在 CoreBuild 之前运行目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44043918/
我正在向我的项目中添加一个自定义 .tt 模板生成目标,以便在 CoreBuild 之前运行,并且似乎有两种方法可以做到: 和 如果我的目标应该在我的项目构建之前运行,因为
我是一名优秀的程序员,十分优秀!