3
votes

I Setup a basic Service Fabric cluster from Visual Studio 2015 Update 2, using the Service Fabric SDK 2.1.150, and the Azure Tools v. 2.9.4

The basic Setup is a Fabric Project and a WebApi service. All works. I then add a C# Class library, as is, and all works.

But when I reference this Class Library from the WebApi project the solution don't deploy in local or in cloud and give me the error:

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.***

I tried to change the csproj file manually added x64 instead of AllCPU, without results. I basically can't reference a class library from the Asp.net Core RC2 WebApi project if is a Service Fabric service.

This do not happen if the WebApi project is a Asp.net WebApi2 project.

How can I fix this? Attached an Image of the project, it's all Visual Studio autogenerated template, no Nuget packages or other code added. Thanks

enter image description here

Update: trying to follow this tutorial:

Build a web service front end for your application

and the guide shows a normal ClassLibrary added to a Fabric Service with Asp.net Core (targeting .NETFramework 4.5.2) Web Api. Is this maybe a bug of the new Service Fabric SDK?

1

1 Answers

1
votes

This occurs, if you try to reference a normal class library from a .NET Core application or library. The small icon left of the ClassLibrary1 in your screenshot seems to indicate a normal class lib. You should replace it with a Class Library (.NET Core), which you will find in the .NET Core project template folder in VS.

Have look on below picture. ClassLibrary2 works fine. ClassLibrary3 throws the error you posted.

Normal vs. .NET Core Lib

Project template

The difference in the project.json of the Web1 project.

Project.json of Web1


Update

Beside using the correct project template, you also have to target the same (or compatible) framework in both the referenced and the referencing lib or application.

Make sure that in both project.json (in Web1 and ClassLibrary2) you are using the same entry for frameworks.

"frameworks": {
    "net452": { }
}