简体   繁体   English

反映编译的程序集并生成文件,作为MSBuild过程的一部分

[英]Reflect compiled assembly and generate a file as part of the MSBuild process

I'm looking to produce a .targets file that I can bundle in a nuget package, which, when the referencing project is built, reflects the compiled assembly and generates a file in the bin folder as part of the build process. 我正在寻找产生一个.targets文件,该文件可以捆绑在nuget包中,在构建引用项目时,该文件会反映编译的程序集,并在生成过程中在bin文件夹中生成一个文件。

Can this be done? 能做到吗? And if so, how? 如果是这样,怎么办?

Rather than generate a .targets file, you could add an install.ps1 to your nuget package, that modifies the csproj file to add a post build event . 可以生成一个install.ps1到nuget包中,而不是生成.targets文件,该包会修改csproj文件以添加post build event From there you can execute any bundled powershell script, or basic shell commands. 从那里,您可以执行任何捆绑的powershell脚本或基本的shell命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM