2013-08-20 65 views
1

我想在TeamCity中建立一個項目,其中包含一些.csproj文件正在使用的DLL,但我不斷收到錯誤(CS0246),因爲他們無法訪問它們的文件夾TeamCity - 使用2個SVN文件夾

我在我的VCS根目錄中添加了2個SVN(Subversion - VisualSVN)文件夾,但是我需要在.csproj文件中進行編輯以編輯目錄..它將其保存爲「..」格式。 \ assemblies \「,但在本地(當去除污漬等)時,它是」.... \ common \ assemblies「

我們的其他項目正在使用DLLs,所以這就是它們爲什麼位於單個文件夾中的原因,不在我們正在研究的項目中。

這有點難以解釋。如果上述內容不夠清楚,我會盡量詳細說明。

<Reference Include="OpenCvSharp.MachineLearning"> 
    <HintPath>..\..\Common\assemblies\OpenCvSharp.MachineLearning.dll</HintPath> 
</Reference> 

應該

<Reference Include="OpenCvSharp.MachineLearning"> 
    <HintPath>..\assemblies\OpenCvSharp.MachineLearning.dll</HintPath> 
</Reference> 

到TeamCity的服務器上正常工作。然而,這不是一種選擇,因爲那樣我們將無法在本地進行調試等,而無需一直改變路徑。

「C:\ TeamCity的\ buildAgent \工作\ fdbaf6ce1c990aa8 \」,那麼所有的SVN文件夾保存在那裏,然後離開了我們的項目的「主」文件夾和包含的DLL

的文件夾任何人知道如何解決這個問題?

回答

1

您可以使用build configurations有條件地引用相同的DLL,但在不同的路徑上。在.csproj的:

<Reference Include="OpenCvSharp.MachineLearning"> 
    <HintPath Condition="'$(Configuration)' == 'Debug'">..\..\Common\assemblies\OpenCvSharp.MachineLearning.dll</HintPath> 
    <HintPath Condition="'$(Configuration)' == 'TeamCity'">..\assemblies\OpenCvSharp.MachineLearning.dll</HintPath> 
</Reference> 

您可以通過在Visual Studio中添加新的生成配置右鍵單擊解決方案資源管理解決方案文件->配置管理器...然後單擊爲活動解決方案配置下拉:並選擇<新建...>

Adding the new TeamCity build configuration

不足之處在於,您必須編輯.csproj文件才能包含上述條件。

+0

我會試試這個,然後回報:) – user2700120