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

Allow .NET Core 2.0 projects to reference assemblies on disk #876

Merged
merged 4 commits into from
Feb 28, 2017
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 build/DependencyVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<!-- Dependencies from test projects -->
<PropertyGroup>
<MicrosoftNETCoreApp20Version>2.0.0-beta-001509-00</MicrosoftNETCoreApp20Version>
<xunitVersion>2.1.0</xunitVersion>
<FluentAssertionsVersion>4.0.0</FluentAssertionsVersion>
<FluentAssertionsJsonVersion>4.12.0</FluentAssertionsJsonVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
CompilationOptions compilationOptions,
string baselineFileName,
string runtime,
ITaskItem[] satelliteAssemblies)
ITaskItem[] assemblySatelliteAssemblies,
Copy link
Contributor

Choose a reason for hiding this comment

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

What is an assemblySatelliteAssemblies?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, it is a poor name. But it matches the name in the product (GenerateDepsFile class). And the reason it is named that in the product is because it matches all the other properties:

  • AssemblyName
  • AssemblyExtension
  • AssemblyVersion
  • AssemblySatelliteAssemblies

ITaskItem[] referencePaths,
ITaskItem[] referenceSatellitePaths)
{
LockFile lockFile = TestLockFiles.GetLockFile(mainProjectName);

Expand All @@ -37,14 +39,20 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
mainProjectName,
".dll",
mainProjectVersion,
satelliteAssemblies ?? new ITaskItem[] { });
assemblySatelliteAssemblies ?? new ITaskItem[] { });

IEnumerable<ReferenceInfo> directReferences =
ReferenceInfo.CreateDirectReferenceInfos(
referencePaths ?? new ITaskItem[] { },
referenceSatellitePaths ?? new ITaskItem[] { });

ProjectContext projectContext = lockFile.CreateProjectContext(
FrameworkConstants.CommonFrameworks.NetCoreApp10,
runtime,
Constants.DefaultPlatformLibrary);

DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, projectContext)
.WithDirectReferences(directReferences)
.WithCompilationOptions(compilationOptions)
.Build();

Expand Down Expand Up @@ -108,14 +116,42 @@ public static IEnumerable<object[]> ProjectData
}),
};

ITaskItem[] referencePaths = new ITaskItem[]
{
new MockTaskItem(
"/usr/Path/RandomLooseLibrary.dll",
new Dictionary<string, string>
{
{ "CopyLocal", "true" },
{ "FusionName", "RandomLooseLibrary, Version=1.2.0.4, Culture=neutral, PublicKeyToken=null" },
{ "ReferenceSourceTarget", "ResolveAssemblyReference" },
{ "Version", "" },
}),
};

ITaskItem[] referenceSatellitePaths = new ITaskItem[]
{
new MockTaskItem(
@"/usr/Path/fr/RandomLooseLibrary.resources.dll",
new Dictionary<string, string>
{
{ "CopyLocal", "true" },
{ "DestinationSubDirectory", "fr/" },
{ "OriginalItemSpec", "/usr/Path/RandomLooseLibrary.dll" },
{ "ResolvedFrom", "{RawFileName}" },
{ "Version", "" },
}),
};

return new[]
{
new object[] { "dotnet.new", "1.0.0", null, "dotnet.new", null, null},
new object[] { "dotnet.new", "1.0.0", null, "dotnet.new.resources", null, dotnetNewSatelliteAssemblies },
new object[] { "simple.dependencies", "1.0.0", null, "simple.dependencies", null, null },
new object[] { "simple.dependencies", "1.0.0", compilationOptions, "simple.dependencies.compilerOptions", null, null},
new object[] { "all.asset.types", "1.0.0", null, "all.asset.types.portable", null, null },
new object[] { "all.asset.types", "1.0.0", null, "all.asset.types.osx", "osx.10.11-x64", null },
new object[] { "dotnet.new", "1.0.0", null, "dotnet.new", null, null, null, null},
new object[] { "dotnet.new", "1.0.0", null, "dotnet.new.resources", null, dotnetNewSatelliteAssemblies, null, null },
new object[] { "simple.dependencies", "1.0.0", null, "simple.dependencies", null, null, null, null },
new object[] { "simple.dependencies", "1.0.0", compilationOptions, "simple.dependencies.compilerOptions", null, null, null, null},
new object[] { "simple.dependencies", "1.0.0", compilationOptions, "simple.dependencies.directReference", null, null, referencePaths, referenceSatellitePaths},
new object[] { "all.asset.types", "1.0.0", null, "all.asset.types.portable", null, null, null, null },
new object[] { "all.asset.types", "1.0.0", null, "all.asset.types.osx", "osx.10.11-x64", null, null, null },
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<None Include="LockFiles\dotnet.new.project.lock.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="simple.dependencies.directReference.deps.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="simple.dependencies.compilerOptions.deps.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Loading