我正在使用Nopcommerce 4.20
的新插件。该插件快要完成了,但我需要准备好发布该插件。但是在Nop.Web/Plugins/
内部创建了不必要的文件夹。
我将Nop.Web
和Nop.Web.Framework
制作为"copy local=false"
,位于Projects下,并删除了该插件并重新构建。但是,我仍然得到了不必要的带有两个字符的文件夹。
<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>
答案 0 :(得分: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" />
尝试这些更改可以为您提供帮助。
答案 1 :(得分:0)
我也遇到了不必要的文件夹创建问题。事实证明,这是由.Net Core 3.0 SDK引起的,它显然以与2.x SDK版本不同的方式构建插件。要检查这一点,您可以从nopcommerce项目文件夹中的命令行运行dotnet --version
。版本不应高于2.x。
解决方法是仅告诉dotnet使用特定的SDK版本来构建项目。只需在我的nopcommerce项目文件夹中添加一个global.json
文件,其中包含以下几行:
{
"sdk": {
"version": "2.2.402"
}
}
再次运行dotnet --version
现在将提供输出2.2.402
。