MSBuild within VS for "Project Plugins"
- I had asked this quesion before, but the moderator accidentally thought it pertained to TFS. My question has nothing to do with TFS. I'll reword my question a bit:
I've created an application that works with plugins: its dynamically (run-time) discovers, loads, and runs them. Currently I have the csproject plugins in the same VS2k8 solution. I'd like to de-couple the VS solution from those csproject plugins, so that VS will build them if it can find them, but does not complain if it cannot find the csprojects representing the plugins.
I think this means I must add a surrogate "Plugins" csproject to my VS solution, and then have that surrogate csproject add all the plugin projects, perhaps like this:
<ItemsGroup>
<Projects Include="$(SolutionDir)MyPluginsRoot\**.csproj" />
</ItemsGroup>
I think as long as those plugin projects use relative paths to reference projects in the main solution, then the build will work: whether launched from VS or launched directly from MSBuild. Has anyone else tried this?
In other words I'm asking: will the MSBuild of VS2k8 understand my markup listed above? And even if yes, is there a better or "standard" way to do this?
I will say again, I'm asking a question about MSBuild - that is why I have an MSBuild script segment in this post. My original thread had been moved here:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/52a8a2c6-9863-4942-b1b2-39d5f9660c5d
-Brent Arias
Answers
Hi Brent Arias,
As far as I know, there is no way to plugin CSProjects in a solution so that VS will not throw exception even it can’t find them.
But if you just want to plugin projects in solution with MSBuild ( if can't find it, VS will throw error), you can add following code snippet in .sln file, and use MSBuild it.
# Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication1", <br/>"WindowsFormsApplication1.csproj", "{89FA1403-6848-4A36-AA07-860752E30370}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication2", <br/>"..\Path\WindowsFormsApplication2.csproj", "{E7B8DD2A-C095-4AAA-9776-BDA912312585}" EndProject
You will find the GUID of a project in its .csproj file. For more information about .sln format, please refer to this link:
http://ondotnet.com/pub/a/dotnet/excerpt/vshacks_chap1/index.html?page=4If you just want to plugin a simple .csproj file in a project, you can use the following code in your .csproj.
<ItemGroup> <Content Include="WindowsFormsApplication2.csproj" /> </ItemGroup>
Projects Item does not exist. In case you want to use a target in a project, you can use <import Project= "$(MyPath)\Project.target"/>.If I misunderstood you, or you have any questions, please let me know.
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byNancy ShaoMSFT, ModeratorFriday, November 06, 2009 10:12 AM
All Replies
Hi Brent Arias,
As far as I know, there is no way to plugin CSProjects in a solution so that VS will not throw exception even it can’t find them.
But if you just want to plugin projects in solution with MSBuild ( if can't find it, VS will throw error), you can add following code snippet in .sln file, and use MSBuild it.
# Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication1", <br/>"WindowsFormsApplication1.csproj", "{89FA1403-6848-4A36-AA07-860752E30370}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication2", <br/>"..\Path\WindowsFormsApplication2.csproj", "{E7B8DD2A-C095-4AAA-9776-BDA912312585}" EndProject
You will find the GUID of a project in its .csproj file. For more information about .sln format, please refer to this link:
http://ondotnet.com/pub/a/dotnet/excerpt/vshacks_chap1/index.html?page=4If you just want to plugin a simple .csproj file in a project, you can use the following code in your .csproj.
<ItemGroup> <Content Include="WindowsFormsApplication2.csproj" /> </ItemGroup>
Projects Item does not exist. In case you want to use a target in a project, you can use <import Project= "$(MyPath)\Project.target"/>.If I misunderstood you, or you have any questions, please let me know.
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byNancy ShaoMSFT, ModeratorFriday, November 06, 2009 10:12 AM


