ASP .Net Core 3.1 build to customer folder with custom name not to netcoreapp3.1

Viewed 692

I have developed a class library for existing project solutions. And It builds successfully.

It's a nop commerce plugin and I need to build it into a specific folder with my project name then plugin manager searching my plugin by name and load it into a page to install it..

When I build it then it builds to a folder named 'netcoreapp3.1'. But I need to build it into a custom folder.

This is my .proj file

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <Copyright>Copyright © Company, Ltd</Copyright>
    <Company>Company, Ltd</Company>
    <Authors>Isanka Thalagala</Authors>
    <PackageLicenseUrl></PackageLicenseUrl>
    <PackageProjectUrl>http://www.nopcommerce.com/</PackageProjectUrl>
    <RepositoryUrl>https://github.com/nopSolutions/nopCommerce</RepositoryUrl>
    <RepositoryType>Git</RepositoryType>
    <OutputPath>..\..\Presentation\Nop.Web\Plugins\Image.Upload.Azure</OutputPath>
    <OutDir>$(OutputPath)</OutDir>
    <!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project.
    You need to set this parameter to true if your plugin has a nuget package 
    to ensure that the dlls copied from the NuGet cache to the output of your project-->
    <CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
  </PropertyGroup>


  <!-- This target execute after "Build" target -->
  <Target Name="NopTarget" AfterTargets="Build">
    <!-- Delete unnecessary libraries from plugins path -->
    <MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
  </Target>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <OutputPath>D:\LabFriend\JohnMorrisCore\API\Presentation\Nop.Web\Plugins\Image.Upload.Azure</OutputPath>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath>D:\LabFriend\JohnMorrisCore\API\Presentation\Nop.Web\Plugins\Image.Upload.Azure</OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="plugin.json" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="ImageResizer" Version="4.2.5" />
    <PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.3" />
    <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
    <ProjectReference Include="..\JohnMorris.Plugin.Core\JohnMorris.Plugin.Core.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="logo.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="plugin.json" />
    <Content Update="plugin.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

</Project>

This is the setting screen

enter image description here

2 Answers

You can set the following in your .csproj to disable this behavior.

<PropertyGroup>
  <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

I downgrade it to .net core 2.2. and now it's allowed to build with custom name

Related