Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ project.lock.json
.builds
*.pidb
*.log
*.binlog
*.scc

# Template Manifests generated as part of VSIX build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ Copyright (c) .NET Foundation. All rights reserved.
To do this, we look at the files that would be copied local when CopyLocalLockFileAssemblies is true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this comment?

-->
<_LockFileAssemblies Include="@(AllCopyLocalItems->WithMetadataValue('Type', 'assembly'))" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing issue, but we also need to do conflict resolution of native assets. Is that covered by this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it is. NuGet.ProjectModel is returning "assembly" for the Type property for this entry in the assets file:

      "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
        "type": "package",
        "runtimeTargets": {
          "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": {
            "assetType": "native",
            "rid": "debian.8-x64"
          }
        }
      },

So when we get to this line, it is included in what we pass to the conflict resolution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, I guess the deps file is still correct since that gets copied from assets but this is something @eerhardt might hit if we tried to reconstruct the deps file from these items.



<!-- Also include RuntimeTarget items, which aren't included in AllCopyLocalItems, but need to be considered
for conflict resolution -->
<_RuntimeTargetItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'RuntimeTarget'))" />
<__RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(_RuntimeTargetItems)" />
<_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" />

<_LockFileAssemblies Include="@(_RuntimeTargetPublishItems->WithMetadataValue('Type', 'assembly')->'%(ResolvedPath)')">
<Private>false</Private>
<NuGetIsFrameworkReference>false</NuGetIsFrameworkReference>
<NuGetSourceType>Package</NuGetSourceType>
<NuGetPackageId>%(PackageName)</NuGetPackageId>
<NuGetPackageVersion>%(PackageVersion)</NuGetPackageVersion>
</_LockFileAssemblies>
</ItemGroup>

<ResolvePackageFileConflicts References="@(Reference)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ public void It_resolves_assembly_conflicts_with_a_NETFramework_library()
IsSdkProject = true
};

project.SourceFiles[project.Name + ".cs"] = $@"
using System;
public static class {project.Name}
{{
{ConflictResolutionAssets.ConflictResolutionTestMethod}
}}";

var testAsset = _testAssetsManager.CreateTestProject(project)
.WithProjectChanges(p =>
{
Expand All @@ -138,7 +145,7 @@ public void It_resolves_assembly_conflicts_with_a_NETFramework_library()
new XAttribute("Include", "NETStandard.Library"),
new XAttribute("Version", "$(BundledNETStandardPackageVersion)")));

foreach (var dependency in TestAsset.NetStandard1_3Dependencies)
foreach (var dependency in ConflictResolutionAssets.ConflictResolutionDependencies)
{
itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", dependency.Item1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ public static class Program
{
public static void Main()
{
TestConflictResolution();
Console.WriteLine(""" + outputMessage + @""");
}
" + ConflictResolutionAssets.ConflictResolutionTestMethod + @"
}
";
var testAsset = _testAssetsManager.CreateTestProject(project, project.Name)
Expand All @@ -167,7 +169,7 @@ public static void Main()
var itemGroup = new XElement(ns + "ItemGroup");
p.Root.Add(itemGroup);

foreach (var dependency in TestAsset.NetStandard1_3Dependencies)
foreach (var dependency in ConflictResolutionAssets.ConflictResolutionDependencies)
{
itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", dependency.Item1),
Expand Down Expand Up @@ -216,6 +218,19 @@ public void It_trims_conflicts_from_the_deps_file()
IsSdkProject = true
};

project.SourceFiles["Program.cs"] = @"
using System;
public static class Program
{
public static void Main()
{
TestConflictResolution();
Console.WriteLine(""Hello, World!"");
}
" + ConflictResolutionAssets.ConflictResolutionTestMethod + @"
}
";

var testAsset = _testAssetsManager.CreateTestProject(project)
.WithProjectChanges(p =>
{
Expand All @@ -224,7 +239,7 @@ public void It_trims_conflicts_from_the_deps_file()
var itemGroup = new XElement(ns + "ItemGroup");
p.Root.Add(itemGroup);

foreach (var dependency in TestAsset.NetStandard1_3Dependencies)
foreach (var dependency in ConflictResolutionAssets.ConflictResolutionDependencies)
{
itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", dependency.Item1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public void It_resolves_assembly_conflicts()
IsSdkProject = true
};

project.SourceFiles[project.Name + ".cs"] = $@"
using System;
public static class {project.Name}
{{
{ConflictResolutionAssets.ConflictResolutionTestMethod}
}}";

var testAsset = _testAssetsManager.CreateTestProject(project)
.WithProjectChanges(p =>
Expand All @@ -60,7 +66,7 @@ public void It_resolves_assembly_conflicts()
var itemGroup = new XElement(ns + "ItemGroup");
p.Root.Add(itemGroup);

foreach (var dependency in TestAsset.NetStandard1_3Dependencies)
foreach (var dependency in ConflictResolutionAssets.ConflictResolutionDependencies)
{
itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", dependency.Item1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ public static class Program
{
public static void Main()
{
TestConflictResolution();
Console.WriteLine(""" + outputMessage + @""");
}
" + ConflictResolutionAssets.ConflictResolutionTestMethod + @"
}
";
var testProjectInstance = _testAssetsManager.CreateTestProject(testProject, testProject.Name)
Expand All @@ -237,7 +239,7 @@ public static void Main()
var itemGroup = new XElement(ns + "ItemGroup");
p.Root.Add(itemGroup);

foreach (var dependency in TestAsset.NetStandard1_3Dependencies)
foreach (var dependency in ConflictResolutionAssets.ConflictResolutionDependencies)
{
itemGroup.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", dependency.Item1),
Expand Down
85 changes: 85 additions & 0 deletions test/Microsoft.NET.TestFramework/ConflictResolutionAssets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;

namespace Microsoft.NET.TestFramework
{
public class ConflictResolutionAssets
{
public static IEnumerable<Tuple<string, string>> ConflictResolutionDependencies
{
get
{
string netstandardDependenciesXml = @"
<group targetFramework="".NETStandard1.3"">
<!--dependency id=""Microsoft.NETCore.Platforms"" version=""1.1.0"" /-->
<dependency id=""Microsoft.Win32.Primitives"" version=""4.3.0"" />
<dependency id=""System.AppContext"" version=""4.3.0"" />
<dependency id=""System.Collections"" version=""4.3.0"" />
<dependency id=""System.Collections.Concurrent"" version=""4.3.0"" />
<dependency id=""System.Console"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Debug"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Tools"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Tracing"" version=""4.3.0"" />
<dependency id=""System.Globalization"" version=""4.3.0"" />
<dependency id=""System.Globalization.Calendars"" version=""4.3.0"" />
<dependency id=""System.IO"" version=""4.3.0"" />
<dependency id=""System.IO.Compression"" version=""4.3.0"" />
<dependency id=""System.IO.Compression.ZipFile"" version=""4.3.0"" />
<dependency id=""System.IO.FileSystem"" version=""4.3.0"" />
<dependency id=""System.IO.FileSystem.Primitives"" version=""4.3.0"" />
<dependency id=""System.Linq"" version=""4.3.0"" />
<dependency id=""System.Linq.Expressions"" version=""4.3.0"" />
<dependency id=""System.Net.Http"" version=""4.3.0"" />
<dependency id=""System.Net.Primitives"" version=""4.3.0"" />
<dependency id=""System.Net.Sockets"" version=""4.3.0"" />
<dependency id=""System.ObjectModel"" version=""4.3.0"" />
<dependency id=""System.Reflection"" version=""4.3.0"" />
<dependency id=""System.Reflection.Extensions"" version=""4.3.0"" />
<dependency id=""System.Reflection.Primitives"" version=""4.3.0"" />
<dependency id=""System.Resources.ResourceManager"" version=""4.3.0"" />
<dependency id=""System.Runtime"" version=""4.3.0"" />
<dependency id=""System.Runtime.Extensions"" version=""4.3.0"" />
<dependency id=""System.Runtime.Handles"" version=""4.3.0"" />
<dependency id=""System.Runtime.InteropServices"" version=""4.3.0"" />
<dependency id=""System.Runtime.InteropServices.RuntimeInformation"" version=""4.3.0"" />
<dependency id=""System.Runtime.Numerics"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Algorithms"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Encoding"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Primitives"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.X509Certificates"" version=""4.3.0"" />
<dependency id=""System.Text.Encoding"" version=""4.3.0"" />
<dependency id=""System.Text.Encoding.Extensions"" version=""4.3.0"" />
<dependency id=""System.Text.RegularExpressions"" version=""4.3.0"" />
<dependency id=""System.Threading"" version=""4.3.0"" />
<dependency id=""System.Threading.Tasks"" version=""4.3.0"" />
<dependency id=""System.Threading.Timer"" version=""4.3.0"" />
<dependency id=""System.Xml.ReaderWriter"" version=""4.3.0"" />
<dependency id=""System.Xml.XDocument"" version=""4.3.0"" />
</group>";

XElement netStandardDependencies = XElement.Parse(netstandardDependenciesXml);

foreach (var dependency in netStandardDependencies.Elements("dependency"))
{
yield return Tuple.Create(dependency.Attribute("id").Value, dependency.Attribute("version").Value);
}

yield return Tuple.Create("System.Diagnostics.TraceSource", "4.0.0");
}
}

public static string ConflictResolutionTestMethod
{
get
{
return @"
public static void TestConflictResolution()
{
new System.Diagnostics.TraceSource(""ConflictTest"");
}";
}
}
}
}
61 changes: 0 additions & 61 deletions test/Microsoft.NET.TestFramework/TestAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,66 +175,5 @@ private bool IsInBinOrObjFolder(string path)
return path.Contains(binFolderWithTrailingSlash)
|| path.Contains(objFolderWithTrailingSlash);
}

public static IEnumerable<Tuple<string, string>> NetStandard1_3Dependencies
{
get
{
string netstandardDependenciesXml = @"
<group targetFramework="".NETStandard1.3"">
<!--dependency id=""Microsoft.NETCore.Platforms"" version=""1.1.0"" /-->
<dependency id=""Microsoft.Win32.Primitives"" version=""4.3.0"" />
<dependency id=""System.AppContext"" version=""4.3.0"" />
<dependency id=""System.Collections"" version=""4.3.0"" />
<dependency id=""System.Collections.Concurrent"" version=""4.3.0"" />
<dependency id=""System.Console"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Debug"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Tools"" version=""4.3.0"" />
<dependency id=""System.Diagnostics.Tracing"" version=""4.3.0"" />
<dependency id=""System.Globalization"" version=""4.3.0"" />
<dependency id=""System.Globalization.Calendars"" version=""4.3.0"" />
<dependency id=""System.IO"" version=""4.3.0"" />
<dependency id=""System.IO.Compression"" version=""4.3.0"" />
<dependency id=""System.IO.Compression.ZipFile"" version=""4.3.0"" />
<dependency id=""System.IO.FileSystem"" version=""4.3.0"" />
<dependency id=""System.IO.FileSystem.Primitives"" version=""4.3.0"" />
<dependency id=""System.Linq"" version=""4.3.0"" />
<dependency id=""System.Linq.Expressions"" version=""4.3.0"" />
<dependency id=""System.Net.Http"" version=""4.3.0"" />
<dependency id=""System.Net.Primitives"" version=""4.3.0"" />
<dependency id=""System.Net.Sockets"" version=""4.3.0"" />
<dependency id=""System.ObjectModel"" version=""4.3.0"" />
<dependency id=""System.Reflection"" version=""4.3.0"" />
<dependency id=""System.Reflection.Extensions"" version=""4.3.0"" />
<dependency id=""System.Reflection.Primitives"" version=""4.3.0"" />
<dependency id=""System.Resources.ResourceManager"" version=""4.3.0"" />
<dependency id=""System.Runtime"" version=""4.3.0"" />
<dependency id=""System.Runtime.Extensions"" version=""4.3.0"" />
<dependency id=""System.Runtime.Handles"" version=""4.3.0"" />
<dependency id=""System.Runtime.InteropServices"" version=""4.3.0"" />
<dependency id=""System.Runtime.InteropServices.RuntimeInformation"" version=""4.3.0"" />
<dependency id=""System.Runtime.Numerics"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Algorithms"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Encoding"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.Primitives"" version=""4.3.0"" />
<dependency id=""System.Security.Cryptography.X509Certificates"" version=""4.3.0"" />
<dependency id=""System.Text.Encoding"" version=""4.3.0"" />
<dependency id=""System.Text.Encoding.Extensions"" version=""4.3.0"" />
<dependency id=""System.Text.RegularExpressions"" version=""4.3.0"" />
<dependency id=""System.Threading"" version=""4.3.0"" />
<dependency id=""System.Threading.Tasks"" version=""4.3.0"" />
<dependency id=""System.Threading.Timer"" version=""4.3.0"" />
<dependency id=""System.Xml.ReaderWriter"" version=""4.3.0"" />
<dependency id=""System.Xml.XDocument"" version=""4.3.0"" />
</group>";

XElement netStandardDependencies = XElement.Parse(netstandardDependenciesXml);

foreach (var dependency in netStandardDependencies.Elements("dependency"))
{
yield return Tuple.Create(dependency.Attribute("id").Value, dependency.Attribute("version").Value);
}
}
}
}
}