Skip to content

Commit

Permalink
Merge pull request #876 from eerhardt/Fix120
Browse files Browse the repository at this point in the history
Allow .NET Core 2.0 projects to reference assemblies on disk
  • Loading branch information
eerhardt authored Feb 28, 2017
2 parents af0910f + 27fc65c commit 475e264
Show file tree
Hide file tree
Showing 16 changed files with 2,898 additions and 50 deletions.
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,
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

0 comments on commit 475e264

Please sign in to comment.