开发者

How to generate code from a power shell script using MSBuild

I've a PowerShell script that generates a partial class 开发者_JAVA百科based on a resource file I've in my cs project.

I'd like to include this new file during compiling time.

Is the Exec Task the way to go? And if so, any examples of how to accomplish this?


You could accomplish this by modifying your .csproj file to automatically include files of a particular pattern, e.g.

<ItemGroup>
  <Compile Include="GeneratedPartialClasses\*.cs" />
</ItemGroup>

Note that Visual Studio will also load these files as part of your project, so you may need to be careful that these generated files aren't accidentally checked-in to source control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜