Skip to content

Commit c52bfd7

Browse files
Added notes.txt
1 parent 591f355 commit c52bfd7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Notes.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Important points when developing plugins
2+
3+
4+
- All views (cshtml files) and web.config file should have "Build action" set to "Content" and "Copy to output directory" set to "Copy if newer"
5+
6+
- When you develop a new plugin from scratch, and when a new class library is added to the solution, open its .csproj file (a main project file) in any text editor and replace its content with the following one
7+
8+
<Project Sdk="Microsoft.NET.Sdk">
9+
<PropertyGroup>
10+
<TargetFramework>net6.0</TargetFramework>
11+
<OutputPath>..\..\Presentation\Nop.Web\Plugins\PLUGIN_OUTPUT_DIRECTORY</OutputPath>
12+
<OutDir>$(OutputPath)</OutDir>
13+
<!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project.
14+
You need to set this parameter to true if your plugin has a nuget package
15+
to ensure that the dlls copied from the NuGet cache to the output of your project-->
16+
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />
21+
</ItemGroup>
22+
23+
<!-- This target execute after "Build" target -->
24+
<Target Name="NopTarget" AfterTargets="Build">
25+
<!-- Delete unnecessary libraries from plugins path -->
26+
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
27+
</Target>
28+
</Project>
29+
30+
Replace “PLUGIN_OUTPUT_DIRECTORY” in the code above with your real plugin output directory name.
31+
32+
It’s not required. But this way we can use a new ASP.NET approach to add third-party references. It was introduced in .NET Core. Furthermore, references from already referenced libraries will be loaded automatically. It’s very convenient.

0 commit comments

Comments
 (0)