【发布时间】:2016-02-18 14:58:28
【问题描述】:
我们最近从一个大的 SLN 文件转移到了多个文件。所以现在文件夹结构是这样的:
- 根
- Solution1WebApp
- 包(文件夹)
- Project1(文件夹)
- Project1.csproj
- NuGet.config
- Solution1.sln
- Solution2 库
- 包(文件夹)
- Project1(文件夹)
- Project1.csproj
- Project2(文件夹)
- Project2.csproj
- NuGet.config
- Solution2.sln
- Solution3UnitTests
- 包(文件夹)
- Project1(文件夹)
- Project1.csproj
- Project2(文件夹)
- Project2.csproj
- Project3(文件夹)
- Project3.csproj
- NuGet.config
- Solution3.sln
- Solution1WebApp
当我在 Visual Studio Online 中签入时,会触发构建。此构建配置为检索 nuget 包(因此未签入包文件夹)。
在Solution1的csproj文件中,我将所有指向包的路径都配置成这样:
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\Solution1WebApp\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
但构建不断失败,我收到如下警告:
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1819, 5)
Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
而且我认为这些警告会导致以下异常:
The type or namespace name 'xxx' does not exist in the namespace 'yyy' (are you missing an assembly reference?)
所以我错过了什么吗?路径配置正确吗?
感谢您的帮助。
【问题讨论】:
-
我认为将单元测试与主题分开不是一个好主意。你应该有两个解决方案,都包含单元测试和他们测试的代码......
-
感谢 MrHinsh 的提示。为了清楚起见,我没有在那里提到它,但是网络应用程序正在引用单元测试项目,以便我们在打开网络应用程序时拥有所有可用的东西。
标签: msbuild visual-studio-2015 nuget-package azure-devops