未使用 Service Fabric 和 Asp.net Core 1.0 WebApi 无状态服务为项目 'ClassLibrary1.csproj' 设置 OutputPath 属性
The OutputPath property is not set for project 'ClassLibrary1.csproj' using Service Fabric and Asp.net Core 1.0 WebApi Stateless Service
我使用 Service Fabric SDK 2.1.150 和 Azure 工具从 Visual Studio 2015 Update 2 设置了一个基本的 Service Fabric 集群五、2.9.4
基本设置是一个 Fabric 项目和一个 WebApi 服务。所有作品。
然后我按原样添加一个 C# Class 库,一切正常。
但是当我从 WebApi 项目引用这个 Class 库时,解决方案没有部署在本地或云中并给我错误:
The OutputPath property is not set for project 'ClassLibrary1.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.***
我尝试更改csproj文件手动添加x64而不是AllCPU,没有结果。
如果是 Service Fabric 服务,我基本上无法从 Asp.net Core RC2 WebApi 项目中引用 class 库。
如果 WebApi 项目是 Asp.netWebApi2 项目,则不会发生这种情况。
我该如何解决这个问题?
附上项目的图像,它都是 Visual Studio 自动生成的模板,没有添加任何 Nuget 包或其他代码。
谢谢
更新:
尝试按照本教程进行操作:
Build a web service front end for your application
并且该指南显示了一个正常的 Class 库添加到具有 Asp.net 核心(针对 .NETFramework 4.5.2)Web Api 的 Fabric 服务。
这可能是新 Service Fabric SDK 的错误吗?
如果您尝试从 .NET Core 应用程序或库中引用 普通 class 库,就会发生这种情况。屏幕截图中 ClassLibrary1 左侧的小图标似乎表示 normal class 库。您应该将其替换为 Class 库 (.NET Core),您可以在 .NET Core 项目模板文件夹中找到它在 VS.
看下图。 ClassLibrary2 工作正常。 ClassLibrary3 抛出您发布的错误。
Web1项目project.json的区别
更新
除了使用正确的项目模板外,您还必须在引用库或应用程序中以相同(或兼容)的框架为目标。
确保在 project.json(在 Web1 和 ClassLibrary2 中)您使用相同的 frameworks.
"frameworks": {
"net452": { }
}
我使用 Service Fabric SDK 2.1.150 和 Azure 工具从 Visual Studio 2015 Update 2 设置了一个基本的 Service Fabric 集群五、2.9.4
基本设置是一个 Fabric 项目和一个 WebApi 服务。所有作品。 然后我按原样添加一个 C# Class 库,一切正常。
但是当我从 WebApi 项目引用这个 Class 库时,解决方案没有部署在本地或云中并给我错误:
The OutputPath property is not set for project 'ClassLibrary1.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.***
我尝试更改csproj文件手动添加x64而不是AllCPU,没有结果。 如果是 Service Fabric 服务,我基本上无法从 Asp.net Core RC2 WebApi 项目中引用 class 库。
如果 WebApi 项目是 Asp.netWebApi2 项目,则不会发生这种情况。
我该如何解决这个问题? 附上项目的图像,它都是 Visual Studio 自动生成的模板,没有添加任何 Nuget 包或其他代码。 谢谢
更新: 尝试按照本教程进行操作:
Build a web service front end for your application
并且该指南显示了一个正常的 Class 库添加到具有 Asp.net 核心(针对 .NETFramework 4.5.2)Web Api 的 Fabric 服务。 这可能是新 Service Fabric SDK 的错误吗?
如果您尝试从 .NET Core 应用程序或库中引用 普通 class 库,就会发生这种情况。屏幕截图中 ClassLibrary1 左侧的小图标似乎表示 normal class 库。您应该将其替换为 Class 库 (.NET Core),您可以在 .NET Core 项目模板文件夹中找到它在 VS.
看下图。 ClassLibrary2 工作正常。 ClassLibrary3 抛出您发布的错误。
Web1项目project.json的区别
更新
除了使用正确的项目模板外,您还必须在引用库或应用程序中以相同(或兼容)的框架为目标。
确保在 project.json(在 Web1 和 ClassLibrary2 中)您使用相同的 frameworks.
"frameworks": {
"net452": { }
}