0
votes

I need some help. I need to publish my ASP.NET Core Web API to an Azure app service. I am getting the error while publishing.

I am using Target Framework .NET Core 2.1 in the Main project and data layer class library.

Error :

InvalidConfigurationMessageText = The OutputPath property is not set for project 'CoreDataLayer.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.

Main project file :

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <_HasReferenceToSystemRuntime>true</_HasReferenceToSystemRuntime>
    <UserSecretsId>acb71015-f783-4442-90c2-3f2aaff100c6</UserSecretsId>
    <StartupObject>NIOXDashboard.Program</StartupObject>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Latest|AnyCPU'">
    <PlatformTarget>AnyCPU;x86</PlatformTarget>
    <OutputPath>bin\Output</OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\CoreDataLayer\CoreDataLayer.csproj" />
    <ProjectReference Include="..\Model\Model.csproj" />
  </ItemGroup>

</Project>

DataLayer Project file :

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <Platforms>AnyCPU;x86</Platforms>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Dapper" Version="2.0.90" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
  </ItemGroup>

</Project>

Model Project file :

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>

</Project>
2
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> try this changeMD. RAKIB HASAN
Thanks for reply. I have tried with above but still not workingskt

2 Answers

0
votes

Usually this happens when the OutputPath property of the project file is blank. Project files are just MSBuild files. To edit in Visual Studio: Open your .csproj file Steps to open .csproj file

  1. Right-click on project with issue -> Unload Project
  2. Right-click on project and choose *Edit .csproj

Add,

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
      <PlatformTarget>x86</PlatformTarget>
      <OutputPath>bin\x86\Any CPU\</OutputPath>  
      . . .  
  </PropertyGroup> 

NOTE: use the OutputPath property definitely.

enter image description here

Try to change AnyCpu to Any Cpu ( with space)

HI Harshita, Thanks for quick reply. In my projst Configuration Manager setting the Deploy Check Box is disabled for all three project. and Platform is "Any CPU" and Configuration is "Release" for all the Project

enter image description here

0
votes

I have successfully Publish my API on Cloud. I have just change the .Net Core 2.1 to .NetCore2.2. Currently Output path is blank in all the sub project.

enter image description here

enter image description here

enter image description here

enter image description here