How to set Build Action for generated files from a T4?

馋奶兔 提交于 2019-12-04 16:49:42

You could use an item group with a wild card. This will make Visual Studio automatically include any file on disk relative to the project which matches the wildcard pattern.

This will only work (that is the files will only show when you load your project) if they exist on disk already.

This pattern will include any files with a g.sql suffix

 <ItemGroup>
    <Build Include="*\*.g.sql" />
 </ItemGroup>

Unfortunately Visual Studio likes to expand these wildcards when you save the project, which effectively removes it. The best way to fix this issue is with indirection.

Create a new MSBuild project file with just the item group in it, then import the new project file with the <Import> element in your SSDT project. The content from the included file will be merged into your primary SSDT project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!