Does anyone know how to add a an MSBuild .proj file to my solution?
有谁知道如何将MSBuild .proj文件添加到我的解决方案?
I was just given existing code from a vendor with a solution that references an MSBuild .proj file as one of its projects. When I open the solution, the project shows as (unavailable). It appears that I need to install some sort of project template to get this project to open correctly. I installed the Codeplex MSBuild Template, but this doesn't appear to be it.
我刚刚从供应商处获得了现有代码,其解决方案将MSBuild .proj文件作为其项目之一。当我打开解决方案时,项目显示为(不可用)。看来我需要安装某种项目模板才能使这个项目正确打开。我安装了Codeplex MSBuild模板,但这似乎不是它。
Any ideas?
2 个解决方案
#1
3
If you don't need IDE support, it's possible to do this using MSBuild solution extension targets.
如果您不需要IDE支持,则可以使用MSBuild解决方案扩展目标来执行此操作。
Create a file named "before.SolutionName.sln.targets" with the following code:
使用以下代码创建名为“before.SolutionName.sln.targets”的文件:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReference Include="CustomProject\CustomProject.proj">
<AdditionalProperties>Configuration=$(Configuration); Platform=AnyCPU</AdditionalProperties>
<Configuration>$(Configuration)</Configuration>
<Platform>AnyCPU</Platform>
</ProjectReference>
</ItemGroup>
</Project>
When your solution is built at command line by MSBuild (ie/ build server) the custom MSBuild project will be pulled into the temporary in-memory project file that MSBuild converts the solution into.
当您的解决方案由MSBuild(即/ build server)在命令行构建时,自定义MSBuild项目将被拉入MSBuild将解决方案转换为的临时内存中项目文件中。
#2
2
I actually got it to work! I re-started Visual Studio and still saw that the projects were unavailable after installing the MSBuild Template mentioned above. I had to manually reload the projects. That fixed the issue.
我实际上得到它的工作!我重新启动Visual Studio,但仍然看到在安装上面提到的MSBuild模板后项目不可用。我不得不手动重新加载项目。这解决了这个问题。
#1
3
If you don't need IDE support, it's possible to do this using MSBuild solution extension targets.
如果您不需要IDE支持,则可以使用MSBuild解决方案扩展目标来执行此操作。
Create a file named "before.SolutionName.sln.targets" with the following code:
使用以下代码创建名为“before.SolutionName.sln.targets”的文件:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReference Include="CustomProject\CustomProject.proj">
<AdditionalProperties>Configuration=$(Configuration); Platform=AnyCPU</AdditionalProperties>
<Configuration>$(Configuration)</Configuration>
<Platform>AnyCPU</Platform>
</ProjectReference>
</ItemGroup>
</Project>
When your solution is built at command line by MSBuild (ie/ build server) the custom MSBuild project will be pulled into the temporary in-memory project file that MSBuild converts the solution into.
当您的解决方案由MSBuild(即/ build server)在命令行构建时,自定义MSBuild项目将被拉入MSBuild将解决方案转换为的临时内存中项目文件中。
#2
2
I actually got it to work! I re-started Visual Studio and still saw that the projects were unavailable after installing the MSBuild Template mentioned above. I had to manually reload the projects. That fixed the issue.
我实际上得到它的工作!我重新启动Visual Studio,但仍然看到在安装上面提到的MSBuild模板后项目不可用。我不得不手动重新加载项目。这解决了这个问题。