0

我正在使用Nopcommerce 4.20. 插件几乎完成了,但我需要让插件准备好分发。但是里面创建了不必要的文件夹Nop.Web/Plugins/

我在 Projects 下制作了andNop.Web并删除了插件并再次构建它。但是,我仍然得到了带有两个字符的不必要的文件夹。Nop.Web.Framework"copy local=false"

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Copyright>SOME_COPYRIGHT</Copyright>
<Company>YOUR_COMPANY</Company>
<Authors>SOME_AUTHORS</Authors>
<PackageLicenseUrl>PACKAGE_LICENSE_URL</PackageLicenseUrl>
<PackageProjectUrl>PACKAGE_PROJECT_URL</PackageProjectUrl>
<RepositoryUrl>REPOSITORY_URL</RepositoryUrl>
<RepositoryType>Git</RepositoryType>

 <OutputPath>..\..\Presentation\Nop.Web\Plugins\Discount.ProductMix
</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>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
  <None Remove="logo.jpeg" />
  <None Remove="plugin.json" />
  <None Remove="Views\Configure.cshtml" />
  <None Remove="Views\DiscountProductAddPopup.cshtml" />
  <None Remove="Views\_ViewImports.cshtml" />
</ItemGroup>
<ItemGroup>
  <Content Include="logo.jpeg">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
  <Content Include="plugin.json">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\DiscountProductAddPopup.cshtml">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\Configure.cshtml">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\_ViewImports.cshtml">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj">
  <Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Presentation\Nop.Web\Nop.Web.csproj">
  <Private>false</Private>
</ProjectReference>
</ItemGroup>

<ItemGroup>
  <Compile Update="Controllers\DiscountProductMixController.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Data\DiscountOfferMixMap.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Data\DiscountProductMixObjectContext.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="DiscountProductMixConfiguration.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Domain\DiscountOffers.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Infrastructure\DependencyRegistrar.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Infrastructure\PluginDBStartup.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
  <Compile Update="Models\ConfigurationModel.cs">
    <CopyToOutputDirectory>Never</CopyToOutputDirectory>
  </Compile>
</ItemGroup>
<!-- 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>

4

2 回答 2

0

我还遇到了创建不必要的文件夹的问题。结果证明这是由 .Net Core 3.0 SDK 引起的,它显然以与 2.x 版 SDK 不同的方式构建插件。要检查这一点,您可以dotnet --version从 nopcommerce 项目文件夹中的命令行运行。版本不应高于 2.x。

解决方法是告诉 dotnet 使用特定的 SDK 版本来构建项目。这只是global.json在我的 nopcommerce 项目文件夹中添加一个包含这些行的文件的问题:

{
  "sdk": {
    "version": "2.2.402"
  }
}

现在再次运行dotnet --version会给出输出2.2.402

于 2019-11-20T11:17:28.187 回答
0

如果您没有安装任何 Nuget 软件包,那么一切都是完美的,那么请设为 false

<CopyLocalLockFileAssemblies>False</CopyLocalLockFileAssemblies>

和另一件事添加替换这些行

<ItemGroup>
<ProjectReference 
 Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj"/>
<ProjectReference Include="..\..\Presentation\Nop.Web\Nop.Web.csproj" />
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />

试试这些改变可以帮助你。

于 2019-09-09T11:33:59.293 回答