This guidance applies to the following SpAgent Configuration packages:
Each of these packages SoftwarePotential.Configuration.Local.<ConfigurationType>-<ShortId> includes an SpAgent.<ConfigurationType>StorageCustomization.cs file that may need to be modified for the following reasons:
- To override the default license storage location e.g. to specify a new base folder/directory
- To override the default activation policies e.g. to set SLL endpoint, activation proxy etc
The SoftwarePotential.Configuration.Distributor-<ShortId> package includes an Sp.Agent.Distributor.Customizations.cs file that may need to be modified to override the default Distributor discovery mechanism required to determine the Distributor service endpoint.
The approach to take depends on whether your project is targeting the Full Framework or NET Core / Standard.
Targeting Full Framework
For projects targeting the .NET Framework, the customization file is installed in the Software Potential folder in your project. If you modify this file you will need to exclude the customization file from the next NuGet package update so that is does not clash with your modified code.
Targeting .NET Core / Standard
For .Net Core / Standard projects the customization file is installed in the NuGet packages folder by default. If you wish to modify this you will need to
- Create a copy in a Software Potential folder in your project and modify this appropriately
- Exclude the original customization file
Exclude Customization File
There are two possible options to exclude the original customization file in a generalized way. The first is to use the $(NugetPackageRoot) property to add a compilation exclusion as follows:
<ItemGroup> <Compile Remove="$(NugetPackageRoot)\\ SoftwarePotential.Configuration.Local.MultiUser-<SHORTCODE>"\\<VERSION>\\contentFiles\\cs\\netstandard2.0\\SoftwarePotential\\SpAgent.MultiUserStorageCustomizations.cs"/> </ItemGroup>
Alternatively you can add the new GeneratePathProperty to the PackageReference. for the relevant configuration package as follows. Please note this option was only added in VS 15.9
<PackageReference Include="SoftwarePotential.Configuration.Local.MultiUser-<SHORTCODE>" Version="4.0.2017.2" GeneratePathProperty="true" />
That will generate a property for MSBuild which you can use to identify the file to be excluded on compilation. The path by convention will start with Pkg and all dots will be replaced with an underscore. The following is an example of excluding it from compilation.
<ItemGroup> <Compile Remove="$(PkgSoftwarePotential_Configuration_Local_MultiUser-<SHORTCODE>)\\contentFiles\\cs\\netstandard2.0\\SoftwarePotential\\SpAgent.MultiUserStorageCustomizations.cs"/> </ItemGroup>