How to embed an XSLT file in a .NET project to be included in the output .exe?

后端 未结 1 429
温柔的废话
温柔的废话 2021-02-08 17:23

I have a simple C# Console App that reads in an XML file specified the the user, runs an XSLT transformation on it, and outputs the results.

When I distribute my app to

相关标签:
1条回答
  • 2021-02-08 17:51

    You can embedd it in your assembly.

    Add the file in your solution, set the build action to embedded resource.

    The place you need to read the file use http://msdn.microsoft.com/en-us/library/xc4235zt.aspx Assembly.GetManifestResourceStream wich will give you a stream wich you can write to a fil or use directly.

    If you are not quite sure what name your resource have, I find Assembly.GetManifestResourceNames usefull to list all resources.

    0 讨论(0)
提交回复
热议问题