1. New Project (.csproj)
Whenever you create a new project, make sure you edit the csproj file to include the following import:
<?xml version="1.0" encoding="utf-8"?> <Project ... > ... <Import Project="..\..\..\..\build\DeltaShell.targets" /> <!-- ADD THIS --> </Project>
This imported targets file takes care of several build steps (such as running PostSharp and copying dependencies).
2. Normal Projects: Dependencies (Auto-copy)
Test Projects: For test projects the external dependencies are not automatically copied from the corresponding lib directory! See section 3 below on how to explicitly force a dependency copy.
Visual Studio typically takes care of copying any managed references you have. For other dependencies several options are available, but the following is recommended (also for managed references).
- Any dependencies you share with other projects should be placed in the
lib
folder directly (not a subfolder):Files here are automatically copied to the Loader.\DeltaShell\lib\
bin
directory on build.
- Any dependencies your project has (whether managed DLLs, native DLLs, license files or other assets), that are not shared with other projects, should be placed in the corresponding lib directory of your project file.
The corresponding lib directory can be found at the same path as your project, but withlib
instead ofsrc
. Thus, for a given project TestPlugin:Any files in the corresponding lib directory will automatically be copied to your output directory (eg: .\bin\Debug) on build.Example (TestPlugin):
Project directory
.\DeltaShell\ src \Plugins\TestPlugin\DeltaShell.Plugins.TestPlugin\
Corresponding lib directory
.\DeltaShell\ lib \Plugins\TestPlugin\DeltaShell.Plugins.TestPlugin\
2.1 Plugins
Add the following entries to the project's csproj file to mark the project as part of a plugin. This will
<?xml version="1.0" encoding="utf-8"?> <Project ... > ... <PropertyGroup> ... <IsPluginComponent>true</IsPluginComponent> <PluginName>$(ProjectName)</PluginName> <UsePostSharp>true</UsePostSharp> <!-- OPTIONAL --> </PropertyGroup> </Project>
3. Test Projects: Dependencies (Custom)
You typically do not need to use this in a normal project (see section above on auto-copy)
In a test project (unmanaged) dependencies are not automatically copied to the output directory of your test project. Instead it is possible to manually define an external dependency folder in the test project's csproj
file.
<?xml version="1.0" encoding="utf-8"?> <Project ... > ... <PropertyGroup> <ExternalDependencies>lib\Plugins\TestPlugin\DeltaShell.Plugins.TestPlugin</ExternalDependencies> ... </PropertyGroup> </Project>