Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copying xml files for assemblies were signed #56 #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/StrongNamer/AddStrongName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public class AddStrongName : Microsoft.Build.Utilities.Task
[Required]
public ITaskItem KeyFile { get; set; }

/// <summary>
/// list of assemblies has been signed
/// </summary>
[Output]
public ITaskItem[] UnsignedAssemblies { get; set; }

public override bool Execute()
{
if (Assemblies == null || Assemblies.Length == 0)
Expand Down Expand Up @@ -64,6 +70,8 @@ public override bool Execute()

Dictionary<string, string> updatedReferencePaths = new Dictionary<string, string>();

var signedAssemblies = new List<ITaskItem>();

using (var resolver = new StrongNamerAssemblyResolver(Assemblies.Select(a => a.ItemSpec)))
{
for (int i = 0; i < Assemblies.Length; i++)
Expand All @@ -73,10 +81,13 @@ public override bool Execute()
{
// Path was updated to signed version
updatedReferencePaths[Assemblies[i].ItemSpec] = SignedAssembliesToReference[i].ItemSpec;
signedAssemblies.Add(Assemblies[i]); //original assembly that has been signed
}
}
}

UnsignedAssemblies = signedAssemblies.ToArray();

if (CopyLocalFiles != null)
{
NewCopyLocalFiles = new ITaskItem[CopyLocalFiles.Length];
Expand Down
10 changes: 10 additions & 0 deletions src/StrongNamer/StrongNamer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@

</Target>

<Target Name="CopyStrongNamerDocTarget" AfterTargets="StrongNamerTarget">

<Copy
SourceFiles="%(UnsignedAssemblies.RootDir)%(UnsignedAssemblies.Directory)%(UnsignedAssemblies.Filename).xml"
DestinationFolder="$(IntermediateOutputPath)SignedAssemblies"
Condition="Exists('%(UnsignedAssemblies.RootDir)%(UnsignedAssemblies.Directory)%(UnsignedAssemblies.Filename).xml')"
SkipUnchangedFiles="true"/>

</Target>

<PropertyGroup>
<ResolveReferencesDependsOn>$(ResolveReferencesDependsOn);StrongNamerTarget</ResolveReferencesDependsOn>
</PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/TestLibrary/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

namespace TestLibrary
{
/// <summary>
/// a test comment
/// </summary>
public class Class1
{
/// <summary>
/// a test method
/// </summary>
public async Task TestAsync()
{
var github = new GitHubClient(new ProductHeaderValue("MyAmazingApp"));
Expand Down
5 changes: 5 additions & 0 deletions src/TestLibrary/TestLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
</ItemGroup>

<Import Project="..\StrongNamer\bin\$(Configuration)\StrongNamer.targets" Condition="Exists('..\StrongNamer\bin\$(Configuration)\StrongNamer.targets')" />

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
</Project>