Closed jdhitsolutions closed 4 months ago
If you do have a signing certificate then provide the CertificateThumbprint
property on the build line.
If you don't have a signing certificate I suggest removing the Sign target from the project.
<Target Name="Sign" AfterTargets="Compile" Condition=" '$(Configuration)' == 'Release' AND '$(OS)' == 'Windows_NT' ">
<ItemGroup>
<FileToSign Include="$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
<Message Importance="high" Text="Signing assemblies: @(FileToSign)" />
<SignFile
SigningTarget="@(FileToSign)"
CertificateThumbprint="$(CertificateThumbprint)"
TimestampUrl="http://timestamp.digicert.com"
/>
</Target>
The package.ps1 should be called by dotnet after the publish phase
<Target Name="Package" AfterTargets="Publish" Condition=" '$(Configuration)' == 'Release' ">
<ItemGroup>
<FilesToDelete Include="$(PublishDir)System.Data.SQLite.dll" />
<FilesToDelete Include="$(PublishDir)$(AssemblyName).deps.json" />
<FilesToDelete Include="$(PublishDir)$(AssemblyName).pdb" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" />
<Exec Command="dotnet tool restore" />
<Exec Command="dotnet pwsh -c "Set-Variable -Name 'ErrorActionPreference' -Value 'Stop'; if ( -not ( Get-Module -ListAvailable -Name '$(Company).PowerShellDataFile' ) ) { Install-Module -Name '$(Company).PowerShellDataFile' -Repository 'PSGallery' -Force }" " />
<Exec Command="dotnet pwsh -ExecutionPolicy Bypass -File ./package.ps1 $(AssemblyName) $(IntermediateOutputPath) $(OutDir) $(PublishDir)" />
<RemoveDir Directories="$(PublishDir)runtimes;$(PublishDir)sqlite-netStandard20-binary" />
<Delete Files="$(OutDir)$(PackageId).psd1" />
</Target>
So you should not need to call it yourself
I further modified the csproj file to invoke pwsh with -Noprofile
When I try to run
dotnet publish SQLiteConnection.csproj --configuration Release
I get an error because I don't have your certificate installed. I'm also not clear if I'm supposed to run this command before or after thepackage.ps1
script.