开发者

Set Copy to Output folder by code

开发者 https://www.devze.com 2023-02-11 06:48 出处:网络
I am developing a code generation tool, so the project files(.csprj) are created by code. Is开发者_开发百科 there any way to mark a content file to be copied always to the output directory?

I am developing a code generation tool, so the project files(.csprj) are created by code. Is开发者_开发百科 there any way to mark a content file to be copied always to the output directory? ...

var project = new BuildEngine.Project();
project.Load(ProjectFile.FullName, ProjectLoadSettings.IgnoreMissingImports);
var buildItem = project.AddNewItem("Content", fileName);   

... I need something like this buildItem.CopyToOutput=true...

project.Save(ProjectFile.FullName);

Every ideas are welcome. Thank you.


Try

buildItem.SetMetadata("CopyToOutputDirectory", "Always");


<Content Include="My.File">
  <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
0

精彩评论

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

关注公众号