2011-04-10 57 views
6

我試圖安裝.msi包我的<Project>元素中進口MSBuild.Community.targets這種方式後,這樣的權利,開始趁着MSBuild Community Tasks內進行的MSBuild社區任務本地依賴性:避免的Visual Studio 2010

<Import Project="lib\MSBuild.Community.Tasks.targets" /> 

有趣的是,我注意到這個文件在MSBuildExtensionsPath中有一個對本地安裝路徑的引用,並且爲了代替儘可能保持代碼依賴性,我願意爲每個項目分配/版本化開銷,我是想知道是否有可能通過項目rel來覆蓋默認/安裝位置一個在.cproj文件中的?

實際的佈局將是這樣的:

Dotnet.Samples.Foobar 
\src 
    Foobar.cs 
\lib 
    MSBuild.Community.Tasks.targets 
    MSBuild.Community.Tasks.dll 

任何指導,將衷心感謝。非常感謝您提供可能想要分享的任何建議。

回答

7

MSBuild.Community.Tasks.targets指定了dll的路徑。

<PropertyGroup> 
    <MSBuildCommunityTasksPath Condition="'$(MSBuildCommunityTasksPath)' == ''">$(MSBuildExtensionsPath)\MSBuildCommunityTasks</MSBuildCommunityTasksPath> 
    <MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib> 
</PropertyGroup> 

您可以覆蓋項目中的路徑。

<PropertyGroup> 
    <MSBuildCommunityTasksPath>lib</MSBuildCommunityTasksPath>  
</PropertyGroup> 

並留下導入相同:

<Import Project="lib\MSBuild.Community.Tasks.targets" /> 
+0

感謝多的貢獻,它的工作如預期。 – 2011-04-12 19:10:30