从代码创建新的 C# 项目文件

发布于 2024-08-21 21:23:32 字数 208 浏览 4 评论 0原文

我目前正在开发一个应用程序,它将生成实际的 .cs 和 .xaml 代码文件并将它们添加到项目中。我已经通过手动编辑现有的 .csproj 文件成功地做到了这一点,并且效果很好。

不过,我也希望能够从我的应用程序创建项目文件,以减少先创建项目然后运行应用程序的额外步骤。

有谁知道如何从应用程序创建 C# 项目(类库或 WPF 应用程序)?我研究过 DTE,但遇到了困难

I'm currently working on an application that will generate actual .cs and .xaml code files and add them to a project. I've managed to do this by manually editing an existing .csproj file and thats working well.

However I would like to be able to create the project files from my application as well, to cut out the extra step of creating the project first then running the application after.

Does anyone know how to create a C# project (class library, or WPF Application) from an application? I've looked into DTE, but I've hit a wall

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零崎曲识 2024-08-28 21:23:32

我无法给出完整的答案,但也许我可以为您指出正确的方向。

在您自己的搜索中探索的一种途径是 MSBuild。 C# 和 VB.net 项目文件遵循 msbuild 格式,因此构建有效项目文件的第一步是构建有效的 msbuild 文件。

另外,听起来你正在做一些不同的事情,但是你看过 T4 系统 用于代码生成?

I can't give a complete answer, but maybe I can point you in the right direction.

One avenue to explore in your own searching is MSBuild. C# and VB.net project files follow the msbuild format, and so the first step in building a valid project file is building a valid msbuild file.

Also, it sounds like you're doing something a little different, but have you looked at the T4 system for code generation?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文