Visual Studio 在线 - 命名空间 xxx 中不存在类型或命名空间名称 yyy
Visual Studio Online - The type or namespace name yyy does not exist in the namespace xxx
我有一个 Visual Studio 2015 年的解决方案,使用 .NET Framework 4.6。在本地,我可以毫无问题地进行编译,并且我使用的是最新版本 (3.1) 的 NuGet。
当我使用 Visual Studio Online 签入然后构建时,出现如下错误:
- Plumbing\DALContainerRegistration.cs (1): The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you
missing an assembly reference?)
- Storage\BlobStorage.cs (5): The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you
missing an assembly reference?)
我知道我在构建服务器上缺少这些引用,但我不知道如何解决这个问题。在上面的两个示例中,我从 NuGet 获取了企业库和 Azure 存储库,因此显然没有理由不工作。
我的 sln 的根目录下有一个 NuGet.config,它的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
你知道哪里出了问题吗?如果您需要任何其他信息,请告诉我。
您需要启用 Restore NuGet Packages
。在 VSO Build vNext 中,您可以在构建步骤中执行此操作。
创建新的构建定义:
我可以通过如下修改 NuGet.config 文件来解决这个问题:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="nuget.orgv3" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
我有一个 Visual Studio 2015 年的解决方案,使用 .NET Framework 4.6。在本地,我可以毫无问题地进行编译,并且我使用的是最新版本 (3.1) 的 NuGet。
当我使用 Visual Studio Online 签入然后构建时,出现如下错误:
- Plumbing\DALContainerRegistration.cs (1): The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
- Storage\BlobStorage.cs (5): The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
我知道我在构建服务器上缺少这些引用,但我不知道如何解决这个问题。在上面的两个示例中,我从 NuGet 获取了企业库和 Azure 存储库,因此显然没有理由不工作。
我的 sln 的根目录下有一个 NuGet.config,它的内容如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
你知道哪里出了问题吗?如果您需要任何其他信息,请告诉我。
您需要启用 Restore NuGet Packages
。在 VSO Build vNext 中,您可以在构建步骤中执行此操作。
创建新的构建定义:
我可以通过如下修改 NuGet.config 文件来解决这个问题:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="nuget.orgv3" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>