Use msbuild community tasks without installing
In our developer environment, no users have administration rights. As such, it's not possible to install MSBuild.CommunityTasks without getting admin to do so.
What I'm wondering is similar to NAnt, i.e. is it possible to include the files in your solution directory, and just reference it from there? This way, 开发者_如何学运维will not matter if the person has it installed, when they checkout latest code, the msbuild community files will come with, and solution will build.
\SolutionDir\{solution}.sln
\SolutionDir\Project\{files}
\SolutionDir\MSBuild.Community\files
Yes you can. Just extract the files and place them somewhere and then use MSBUILD IMPORT to pull them in the project file. You'll need to import the targets files.
Preet's answer is spot on, but there are some complexities in using the import. In order to get the import to work properly, I needed to follow the answer outlined by Tom.
Specifically,
<PropertyGroup>
<MSBuildCommunityTasksPath>location of community files</MSBuildCommunityTasksPath>
</PropertyGroup>
<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets"/>
This sets up the path for the targets file.
精彩评论