相关疑难解决方法(0)

使用PowerShell将现有项目添加到解决方案文件夹

我正在开发PowerShell脚本,以动态创建Visual Studio项目并将其文件夹和资产添加到解决方案中.我正在使用Visual Studio DTE.

我在文件系统上的目录结构如下:

C:\Dir1\Dir2\Stuff
|
+--Stuff                  <-- folder
|  |
|  `Stuff.csproj          <-- existing project, included in sln
|
+--Subfolder              <-- Subfolder in which I want to include my new csproj
|  +--Project1            <-- folder
|  |  |
|  |  `Project1.csproj    <-- existing project, included in sln
|  |
|  +--Project2            <-- folder
|  |  |
|  |  `Project2.csproj    <-- existing project, included in sln
|  |
|  `--Project3            <-- this, subs below and csproj are created from …
Run Code Online (Sandbox Code Playgroud)

powershell visual-studio envdte

9
推荐指数
1
解决办法
3956
查看次数

Visual Studio宏:查找未包含在项目中的文件?

我想编写一个宏来遍历项目目录中的文件,并查找未包含在项目中的文件.

在玩DTE对象时,我看到Project对象有ProjectItems; 如果a ProjectItem代表一个目录,那么它有自己的ProjectItems集合.这为我提供了项目中包含的所有文件.

因此,我可以递归遍历每个ProjectItems集合,并且对于作为目录的每个ProjectItem,检查文件系统中是否存在没有相应ProjectItem的文件.但这看起来很笨拙.

有没有更简单的方法来解决这个问题?

macros visual-studio visual-studio-macros

8
推荐指数
2
解决办法
9735
查看次数