I'm currently automating the inte开发者_Go百科gration of a .NET project. MSBuild and PowerShell are my tools of choice. I need to store the configuration of environments (host addresses, paths, service names, etc.) in a separate file that both MSBuild and PowerShell can easily read. What is the simplest format for this purpose? Is there anything simpler than custom XML?
I wouldn't mind adding additional tasks to MSBuild but I'd like to avoid augmenting PowerShell since the latter is used on the target machines and the less requirements there are for them, the better.
UPDATE: I have since decided to just go with MSBuild alone since I have found that I can do all the deployment tasks remotely without actually logging into the target machine. Thank you anyway for the answers!
I would use XML in this case. You can use PowerShell to create and modify a MSBuild properties file i.e. a MSBuild project file that contains PropertyGroup elements. You can then import this file into MSBuild which will make the properties it define easily accessible at that point. And since it is XML, PowerShell can also easily access the same data.
MSBuild understands only configuration in xml and environment variables.
PS understands environment variables too but it's not good.
You can write custom task for MSBuild and custom cmdlet for powershell and use your own format.
You can call PS from MSBuild and MSbuild from PS. You can have PS-scripts and call it in MSBuild.
精彩评论