Merge pull request #2124 from cdmihai/cdmihai/patchLockFile
xproj / csproj interoperability
This commit is contained in:
commit
54b2ddec06
59 changed files with 1890 additions and 140 deletions
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"ClassLibrary1": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary2": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary3": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x64": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x86": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary1/ClassLibrary1.csproj"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary2/ClassLibrary2.csproj"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary3/ClassLibrary3.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": [
|
||||
"ClassLibrary1",
|
||||
"ClassLibrary2",
|
||||
"ClassLibrary3"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"version": 3,
|
||||
"exports": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.5.2",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"ClassLibrary1": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary2": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary3": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x64": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x86": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary1/ClassLibrary1.csproj"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary2/ClassLibrary2.csproj"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary3/ClassLibrary3.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": [
|
||||
"ClassLibrary1",
|
||||
"ClassLibrary2",
|
||||
"ClassLibrary3"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"ClassLibrary1": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary2": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary3": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x64": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x86": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary1/ClassLibrary1.csproj"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary2/ClassLibrary2.csproj"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary3/ClassLibrary3.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": [
|
||||
"ClassLibrary1",
|
||||
"ClassLibrary2",
|
||||
"ClassLibrary3"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.5.2",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
TestAssets/LockFiles/ExportFiles/valid/project.json
Normal file
22
TestAssets/LockFiles/ExportFiles/valid/project.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"ClassLibrary1": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary2": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary3": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
61
TestAssets/LockFiles/ExportFiles/valid/project.lock.json
Normal file
61
TestAssets/LockFiles/ExportFiles/valid/project.lock.json
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x64": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x86": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary1/ClassLibrary1.csproj"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary2/ClassLibrary2.csproj"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary3/ClassLibrary3.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": [
|
||||
"ClassLibrary1",
|
||||
"ClassLibrary2",
|
||||
"ClassLibrary3"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.5.2",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": { }
|
||||
},
|
||||
"libraries": {
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": []
|
||||
}
|
||||
}
|
3
TestAssets/ProjectModelServer/MSBuildReferencesProjects/.gitignore
vendored
Normal file
3
TestAssets/ProjectModelServer/MSBuildReferencesProjects/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Negates the lock file
|
||||
# MSBuiild references' project model server tests requires these lock files, since they can't be created without VS tooling.
|
||||
!project.lock.json
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ClassLibrary1
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FD073258-550B-4E57-86AE-DC4874015EB1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>ClassLibrary1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ClassLibrary1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ClassLibrary1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fd073258-550b-4e57-86ae-dc4874015eb1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
|
||||
</packages>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ClassLibrary2
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>0f2d2a48-e867-496c-85a7-e97b64cfeda4</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary2</RootNamespace>
|
||||
<AssemblyName>ClassLibrary2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Xml.Linq"/>
|
||||
<Reference Include="System.Data.DataSetExtensions"/>
|
||||
|
||||
|
||||
<Reference Include="Microsoft.CSharp"/>
|
||||
|
||||
<Reference Include="System.Data"/>
|
||||
|
||||
<Reference Include="System.Net.Http"/>
|
||||
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ClassLibrary2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ClassLibrary2")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0f2d2a48-e867-496c-85a7-e97b64cfeda4")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ClassLibrary3
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>428e95cb-8435-414b-a313-9d734c633b3e</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary3</RootNamespace>
|
||||
<AssemblyName>ClassLibrary3</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Xml.Linq"/>
|
||||
<Reference Include="System.Data.DataSetExtensions"/>
|
||||
|
||||
|
||||
<Reference Include="Microsoft.CSharp"/>
|
||||
|
||||
<Reference Include="System.Data"/>
|
||||
|
||||
<Reference Include="System.Net.Http"/>
|
||||
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ClassLibrary3")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ClassLibrary3")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("428e95cb-8435-414b-a313-9d734c633b3e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25029.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1443ACE0-3065-4C20-AD59-D561798AE0A5}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0AE82780-22C8-4DC8-8F1E-86977FDD092F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
global.json = global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ConsoleApp13", "src\ConsoleApp13\ConsoleApp13.xproj", "{767D3038-AC3A-4722-B21F-F85F2CBC3AA3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{FD073258-550B-4E57-86AE-DC4874015EB1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary2", "ClassLibrary2\ClassLibrary2.csproj", "{0F2D2A48-E867-496C-85A7-E97B64CFEDA4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary3", "ClassLibrary3\ClassLibrary3.csproj", "{428E95CB-8435-414B-A313-9D734C633B3E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{767D3038-AC3A-4722-B21F-F85F2CBC3AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{767D3038-AC3A-4722-B21F-F85F2CBC3AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{767D3038-AC3A-4722-B21F-F85F2CBC3AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{767D3038-AC3A-4722-B21F-F85F2CBC3AA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FD073258-550B-4E57-86AE-DC4874015EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FD073258-550B-4E57-86AE-DC4874015EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FD073258-550B-4E57-86AE-DC4874015EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FD073258-550B-4E57-86AE-DC4874015EB1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F2D2A48-E867-496C-85A7-E97B64CFEDA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F2D2A48-E867-496C-85A7-E97B64CFEDA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F2D2A48-E867-496C-85A7-E97B64CFEDA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F2D2A48-E867-496C-85A7-E97B64CFEDA4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{428E95CB-8435-414B-A313-9D734C633B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{428E95CB-8435-414B-A313-9D734C633B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{428E95CB-8435-414B-A313-9D734C633B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{428E95CB-8435-414B-A313-9D734C633B3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{767D3038-AC3A-4722-B21F-F85F2CBC3AA3} = {1443ACE0-3065-4C20-AD59-D561798AE0A5}
|
||||
{FD073258-550B-4E57-86AE-DC4874015EB1} = {1443ACE0-3065-4C20-AD59-D561798AE0A5}
|
||||
{0F2D2A48-E867-496C-85A7-E97B64CFEDA4} = {1443ACE0-3065-4C20-AD59-D561798AE0A5}
|
||||
{428E95CB-8435-414B-A313-9D734C633B3E} = {1443ACE0-3065-4C20-AD59-D561798AE0A5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"projects": [ "src", "test" ]
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>767d3038-ac3a-4722-b21f-f85f2cbc3aa3</ProjectGuid>
|
||||
<RootNamespace>ConsoleApp13</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ClassLibrary1\ClassLibrary1.csproj" />
|
||||
<ProjectReference Include="..\..\ClassLibrary2\ClassLibrary2.csproj" />
|
||||
<ProjectReference Include="..\..\ClassLibrary3\ClassLibrary3.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp13
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var q = new ClassLibrary1.Class1();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConsoleApp13")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("767d3038-ac3a-4722-b21f-f85f2cbc3aa3")]
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"version": 2,
|
||||
"exports": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.5.2",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"../packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll": {},
|
||||
"bin/Debug/ClassLibrary1.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary2.dll": {}
|
||||
}
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"framework": ".NETFramework,Version=v4.6",
|
||||
"compile": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"bin/Debug/ClassLibrary3.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"ClassLibrary1": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary2": {
|
||||
"target": "project"
|
||||
},
|
||||
"ClassLibrary3": {
|
||||
"target": "project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
".NETFramework,Version=v4.6": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x64": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.6/win7-x86": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project"
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"ClassLibrary1/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary1/ClassLibrary1.csproj"
|
||||
},
|
||||
"ClassLibrary2/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary2/ClassLibrary2.csproj"
|
||||
},
|
||||
"ClassLibrary3/1.0.0": {
|
||||
"type": "project",
|
||||
"msbuildProject": "../../ClassLibrary3/ClassLibrary3.csproj"
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [],
|
||||
".NETFramework,Version=v4.6": [
|
||||
"ClassLibrary1",
|
||||
"ClassLibrary2",
|
||||
"ClassLibrary3"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -140,11 +140,12 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
return LibraryExportBuilder.Create(library).Build();
|
||||
}
|
||||
|
||||
if (Equals(LibraryType.Package, library.Identity.Type))
|
||||
var libraryType = library.Identity.Type;
|
||||
if (Equals(LibraryType.Package, libraryType) || Equals(LibraryType.MSBuildProject, libraryType))
|
||||
{
|
||||
return ExportPackage((PackageDescription)library);
|
||||
return ExportPackage((TargetLibraryWithAssets)library);
|
||||
}
|
||||
else if (Equals(LibraryType.Project, library.Identity.Type))
|
||||
else if (Equals(LibraryType.Project, libraryType))
|
||||
{
|
||||
return ExportProject((ProjectDescription)library);
|
||||
}
|
||||
|
@ -154,22 +155,26 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
}
|
||||
}
|
||||
|
||||
private LibraryExport ExportPackage(PackageDescription package)
|
||||
private LibraryExport ExportPackage(TargetLibraryWithAssets library)
|
||||
{
|
||||
var builder = LibraryExportBuilder.Create(package);
|
||||
builder.AddNativeLibraryGroup(new LibraryAssetGroup(PopulateAssets(package, package.NativeLibraries)));
|
||||
builder.AddRuntimeAssemblyGroup(new LibraryAssetGroup(PopulateAssets(package, package.RuntimeAssemblies)));
|
||||
builder.WithCompilationAssemblies(PopulateAssets(package, package.CompileTimeAssemblies));
|
||||
builder.WithSourceReferences(GetSharedSources(package));
|
||||
builder.WithAnalyzerReference(GetAnalyzerReferences(package));
|
||||
var builder = LibraryExportBuilder.Create(library);
|
||||
builder.AddNativeLibraryGroup(new LibraryAssetGroup(PopulateAssets(library, library.NativeLibraries)));
|
||||
builder.AddRuntimeAssemblyGroup(new LibraryAssetGroup(PopulateAssets(library, library.RuntimeAssemblies)));
|
||||
builder.WithCompilationAssemblies(PopulateAssets(library, library.CompileTimeAssemblies));
|
||||
|
||||
if (package.ContentFiles.Any())
|
||||
if (library.Identity.Type.Equals(LibraryType.Package))
|
||||
{
|
||||
builder.WithSourceReferences(GetSharedSources((PackageDescription) library));
|
||||
builder.WithAnalyzerReference(GetAnalyzerReferences((PackageDescription) library));
|
||||
}
|
||||
|
||||
if (library.ContentFiles.Any())
|
||||
{
|
||||
var parameters = PPFileParameters.CreateForProject(_rootProject.Project);
|
||||
Action<Stream, Stream> transform = (input, output) => PPFilePreprocessor.Preprocess(input, output, parameters);
|
||||
|
||||
var sourceCodeLanguage = _rootProject.Project.GetSourceCodeLanguage();
|
||||
var languageGroups = package.ContentFiles.GroupBy(file => file.CodeLanguage);
|
||||
var languageGroups = library.ContentFiles.GroupBy(file => file.CodeLanguage);
|
||||
var selectedGroup = languageGroups.FirstOrDefault(g => g.Key == sourceCodeLanguage) ??
|
||||
languageGroups.FirstOrDefault(g => g.Key == null);
|
||||
if (selectedGroup != null)
|
||||
|
@ -184,14 +189,14 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
|
||||
var fileTransform = contentFile.PPOutputPath != null ? transform : null;
|
||||
|
||||
var fullPath = Path.Combine(package.Path, contentFile.Path);
|
||||
var fullPath = Path.Combine(library.Path, contentFile.Path);
|
||||
if (contentFile.BuildAction == BuildAction.Compile)
|
||||
{
|
||||
builder.AddSourceReference(LibraryAsset.CreateFromRelativePath(package.Path, contentFile.Path, fileTransform));
|
||||
builder.AddSourceReference(LibraryAsset.CreateFromRelativePath(library.Path, contentFile.Path, fileTransform));
|
||||
}
|
||||
else if (contentFile.BuildAction == BuildAction.EmbeddedResource)
|
||||
{
|
||||
builder.AddEmbedddedResource(LibraryAsset.CreateFromRelativePath(package.Path, contentFile.Path, fileTransform));
|
||||
builder.AddEmbedddedResource(LibraryAsset.CreateFromRelativePath(library.Path, contentFile.Path, fileTransform));
|
||||
}
|
||||
if (contentFile.CopyToOutput)
|
||||
{
|
||||
|
@ -200,9 +205,9 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
}
|
||||
}
|
||||
}
|
||||
if (package.RuntimeTargets.Any())
|
||||
if (library.RuntimeTargets.Any())
|
||||
{
|
||||
foreach (var targetGroup in package.RuntimeTargets.GroupBy(t => t.Runtime))
|
||||
foreach (var targetGroup in library.RuntimeTargets.GroupBy(t => t.Runtime))
|
||||
{
|
||||
var runtime = new List<LibraryAsset>();
|
||||
var native = new List<LibraryAsset>();
|
||||
|
@ -211,11 +216,11 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
{
|
||||
if (string.Equals(lockFileRuntimeTarget.AssetType, "native", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
native.Add(LibraryAsset.CreateFromRelativePath(package.Path, lockFileRuntimeTarget.Path));
|
||||
native.Add(LibraryAsset.CreateFromRelativePath(library.Path, lockFileRuntimeTarget.Path));
|
||||
}
|
||||
else if (string.Equals(lockFileRuntimeTarget.AssetType, "runtime", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
runtime.Add(LibraryAsset.CreateFromRelativePath(package.Path, lockFileRuntimeTarget.Path));
|
||||
runtime.Add(LibraryAsset.CreateFromRelativePath(library.Path, lockFileRuntimeTarget.Path));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +347,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
private IEnumerable<LibraryAsset> GetSharedSources(PackageDescription package)
|
||||
{
|
||||
return package
|
||||
.Library
|
||||
.PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("shared" + Path.DirectorySeparatorChar))
|
||||
.Select(path => LibraryAsset.CreateFromRelativePath(package.Path, path));
|
||||
|
@ -351,11 +356,12 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
private IEnumerable<AnalyzerReference> GetAnalyzerReferences(PackageDescription package)
|
||||
{
|
||||
var analyzers = package
|
||||
.Library
|
||||
.PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("analyzers" + Path.DirectorySeparatorChar) &&
|
||||
path.EndsWith(".dll"));
|
||||
|
||||
|
||||
var analyzerRefs = new List<AnalyzerReference>();
|
||||
// See https://docs.nuget.org/create/analyzers-conventions for the analyzer
|
||||
// NuGet specification
|
||||
|
@ -416,12 +422,11 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
return analyzerRefs;
|
||||
}
|
||||
|
||||
|
||||
private IEnumerable<LibraryAsset> PopulateAssets(PackageDescription package, IEnumerable<LockFileItem> section)
|
||||
private IEnumerable<LibraryAsset> PopulateAssets(TargetLibraryWithAssets library, IEnumerable<LockFileItem> section)
|
||||
{
|
||||
foreach (var assemblyPath in section)
|
||||
{
|
||||
yield return LibraryAsset.CreateFromRelativePath(package.Path, assemblyPath.Path);
|
||||
yield return LibraryAsset.CreateFromRelativePath(library.Path, assemblyPath.Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
{
|
||||
var type = export.Library.Identity.Type;
|
||||
|
||||
var serviceable = (export.Library as PackageDescription)?.Library.IsServiceable ?? false;
|
||||
var serviceable = (export.Library as PackageDescription)?.PackageLibrary.IsServiceable ?? false;
|
||||
var libraryDependencies = new HashSet<Dependency>();
|
||||
|
||||
foreach (var libraryDependency in export.Library.Dependencies)
|
||||
|
|
|
@ -13,5 +13,8 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
|
||||
// Multiple libraries marked as "platform"
|
||||
public static readonly string DOTNET1013 = nameof(DOTNET1013);
|
||||
|
||||
// Failed to read lock file
|
||||
public static readonly string DOTNET1014 = nameof(DOTNET1014);
|
||||
}
|
||||
}
|
||||
|
|
22
src/Microsoft.DotNet.ProjectModel/Graph/ExportFile.cs
Normal file
22
src/Microsoft.DotNet.ProjectModel/Graph/ExportFile.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Graph
|
||||
{
|
||||
public class ExportFile
|
||||
{
|
||||
public static readonly string ExportFileName = "project.fragment.lock.json";
|
||||
|
||||
public int Version { get; }
|
||||
public string ExportFilePath { get; }
|
||||
|
||||
public IList<LockFileTargetLibrary> Exports { get; }
|
||||
|
||||
public ExportFile(string exportFilePath, int version, IList<LockFileTargetLibrary> exports)
|
||||
{
|
||||
ExportFilePath = exportFilePath;
|
||||
Version = version;
|
||||
Exports = exports.Any() ? exports : new List<LockFileTargetLibrary>(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,11 +11,13 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
public static readonly LibraryType Package = new LibraryType(nameof(Package));
|
||||
public static readonly LibraryType Project = new LibraryType(nameof(Project));
|
||||
public static readonly LibraryType ReferenceAssembly = new LibraryType(nameof(ReferenceAssembly));
|
||||
public static readonly LibraryType MSBuildProject = new LibraryType(nameof(MSBuildProject));
|
||||
|
||||
// Default value
|
||||
public static readonly LibraryType Unspecified = new LibraryType();
|
||||
|
||||
public string Value { get; }
|
||||
|
||||
|
||||
private LibraryType(string value)
|
||||
{
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Graph
|
||||
{
|
||||
|
@ -22,6 +19,7 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
public IList<LockFilePackageLibrary> PackageLibraries { get; set; } = new List<LockFilePackageLibrary>();
|
||||
public IList<LockFileProjectLibrary> ProjectLibraries { get; set; } = new List<LockFileProjectLibrary>();
|
||||
public IList<LockFileTarget> Targets { get; set; } = new List<LockFileTarget>();
|
||||
public ExportFile ExportFile { get; set; }
|
||||
|
||||
public LockFile(string lockFilePath)
|
||||
{
|
||||
|
|
128
src/Microsoft.DotNet.ProjectModel/Graph/LockFilePatcher.cs
Normal file
128
src/Microsoft.DotNet.ProjectModel/Graph/LockFilePatcher.cs
Normal file
|
@ -0,0 +1,128 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Graph
|
||||
{
|
||||
public class LockFilePatcher
|
||||
{
|
||||
private readonly LockFile _lockFile;
|
||||
private Dictionary<string, IList<LockFileTargetLibrary>> _msbuildTargetLibraries;
|
||||
|
||||
public LockFilePatcher(LockFile lockFile)
|
||||
{
|
||||
_lockFile = lockFile;
|
||||
|
||||
var msbuildProjectLibraries = lockFile.ProjectLibraries.Where(MSBuildDependencyProvider.IsMSBuildProjectLibrary);
|
||||
_msbuildTargetLibraries = msbuildProjectLibraries.ToDictionary(GetProjectLibraryKey, l => GetTargetsForLibrary(_lockFile, l));
|
||||
}
|
||||
|
||||
public void PatchIfNecessary()
|
||||
{
|
||||
var exportFilePath = GetExportFilePath(_lockFile.LockFilePath);
|
||||
|
||||
if (File.Exists(exportFilePath) && _msbuildTargetLibraries.Any())
|
||||
{
|
||||
var exportFile = LockFileReader.ReadExportFile(exportFilePath);
|
||||
PatchLockWithExport(exportFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
ThrowIfAnyMsbuildLibrariesPresent();
|
||||
}
|
||||
}
|
||||
|
||||
public void ThrowIfAnyMsbuildLibrariesPresent()
|
||||
{
|
||||
if (_msbuildTargetLibraries.Any())
|
||||
{
|
||||
throw new LockFilePatchingException($"Lock file {_lockFile} contains msbuild projects but there is no export file");
|
||||
}
|
||||
}
|
||||
|
||||
private void PatchLockWithExport(ExportFile exportFile)
|
||||
{
|
||||
if (_lockFile.Version != exportFile.Version)
|
||||
{
|
||||
throw new LockFilePatchingException($"Export file {exportFile.ExportFilePath} has a different version than the lock file {_lockFile.LockFilePath}");
|
||||
}
|
||||
|
||||
var exportDict = exportFile.Exports.ToDictionary(GetTargetLibraryKey);
|
||||
|
||||
var uncoveredLibraries = _msbuildTargetLibraries.Keys.Except(exportDict.Keys);
|
||||
if (uncoveredLibraries.Any())
|
||||
{
|
||||
throw new LockFilePatchingException($"Export {exportFile.ExportFilePath} does not provide exports for all the msbuild projects in {_lockFile.LockFilePath}");
|
||||
}
|
||||
|
||||
foreach(var exportKey in exportDict.Keys)
|
||||
{
|
||||
var export = exportDict[exportKey];
|
||||
var librariesToPatch = _msbuildTargetLibraries[exportKey];
|
||||
|
||||
foreach (var libraryToPatch in librariesToPatch)
|
||||
{
|
||||
Patch(libraryToPatch, export);
|
||||
}
|
||||
}
|
||||
|
||||
_lockFile.ExportFile = exportFile;
|
||||
}
|
||||
|
||||
private static void Patch(LockFileTargetLibrary libraryToPatch, LockFileTargetLibrary export)
|
||||
{
|
||||
libraryToPatch.CompileTimeAssemblies = export.CompileTimeAssemblies;
|
||||
libraryToPatch.ContentFiles = export.ContentFiles;
|
||||
libraryToPatch.FrameworkAssemblies = export.FrameworkAssemblies;
|
||||
libraryToPatch.NativeLibraries = export.NativeLibraries;
|
||||
libraryToPatch.ResourceAssemblies = export.ResourceAssemblies;
|
||||
libraryToPatch.RuntimeAssemblies = export.RuntimeAssemblies;
|
||||
}
|
||||
|
||||
private static IList<LockFileTargetLibrary> GetTargetsForLibrary(LockFile lockFile, LockFileProjectLibrary library)
|
||||
{
|
||||
return lockFile.Targets
|
||||
.SelectMany(
|
||||
t => t.Libraries
|
||||
.Where(
|
||||
l => string.Equals(GetProjectLibraryKey(library), (GetTargetLibraryKey(l)))
|
||||
)
|
||||
)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static object TypeName(LockFileTargetLibrary library)
|
||||
{
|
||||
return library.Name + "/" + library.Version + "/" + library.Type;
|
||||
}
|
||||
|
||||
private static string GetTargetLibraryKey(LockFileTargetLibrary library)
|
||||
{
|
||||
return library.Name + "/" + library.Version;
|
||||
}
|
||||
|
||||
private static string GetProjectLibraryKey(LockFileProjectLibrary library)
|
||||
{
|
||||
return library.Name + "/" + library.Version;
|
||||
}
|
||||
|
||||
private static string GetExportFilePath(string masterLockFilePath)
|
||||
{
|
||||
var parentDirectory = Directory.GetParent(masterLockFilePath).FullName;
|
||||
return Path.Combine(parentDirectory, ExportFile.ExportFileName);
|
||||
}
|
||||
}
|
||||
|
||||
internal class LockFilePatchingException : Exception
|
||||
{
|
||||
public LockFilePatchingException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -12,5 +12,7 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
public NuGetVersion Version { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public string MSBuildProject { get; set; }
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
{
|
||||
public static class LockFileReader
|
||||
{
|
||||
public static LockFile Read(string lockFilePath)
|
||||
public static LockFile Read(string lockFilePath, bool patchWithExportFile = true)
|
||||
{
|
||||
using (var stream = ResilientFileStreamOpener.OpenFile(lockFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
return Read(lockFilePath, stream);
|
||||
return Read(lockFilePath, stream, patchWithExportFile);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
|
@ -34,21 +34,36 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
}
|
||||
}
|
||||
|
||||
public static LockFile Read(string lockFilePath, Stream stream)
|
||||
public static LockFile Read(string lockFilePath, Stream stream, bool patchWithExportFile = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var reader = new StreamReader(stream);
|
||||
var jobject = JsonDeserializer.Deserialize(reader) as JsonObject;
|
||||
|
||||
if (jobject != null)
|
||||
{
|
||||
return ReadLockFile(lockFilePath, jobject);
|
||||
}
|
||||
else
|
||||
if (jobject == null)
|
||||
{
|
||||
throw new InvalidDataException();
|
||||
}
|
||||
|
||||
var lockFile = ReadLockFile(lockFilePath, jobject);
|
||||
|
||||
var patcher = new LockFilePatcher(lockFile);
|
||||
|
||||
if (patchWithExportFile)
|
||||
{
|
||||
patcher.PatchIfNecessary();
|
||||
}
|
||||
else
|
||||
{
|
||||
patcher.ThrowIfAnyMsbuildLibrariesPresent();
|
||||
}
|
||||
|
||||
return lockFile;
|
||||
}
|
||||
catch (LockFilePatchingException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -60,6 +75,36 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
}
|
||||
}
|
||||
|
||||
public static ExportFile ReadExportFile(string fragmentLockFilePath)
|
||||
{
|
||||
using (var stream = ResilientFileStreamOpener.OpenFile(fragmentLockFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var rootJObject = JsonDeserializer.Deserialize(new StreamReader(stream)) as JsonObject;
|
||||
|
||||
if (rootJObject == null)
|
||||
{
|
||||
throw new InvalidDataException();
|
||||
}
|
||||
|
||||
var version = ReadInt(rootJObject, "version", defaultValue: int.MinValue);
|
||||
var exports = ReadObject(rootJObject.ValueAsJsonObject("exports"), ReadTargetLibrary);
|
||||
|
||||
return new ExportFile(fragmentLockFilePath, version, exports);
|
||||
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
throw ex.WithFilePath(fragmentLockFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw FileFormatException.Create(ex, fragmentLockFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static LockFile ReadLockFile(string lockFilePath, JsonObject cursor)
|
||||
{
|
||||
var lockFile = new LockFile(lockFilePath);
|
||||
|
@ -105,12 +150,19 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
}
|
||||
else if (type == "project")
|
||||
{
|
||||
lockFile.ProjectLibraries.Add(new LockFileProjectLibrary
|
||||
var projectLibrary = new LockFileProjectLibrary
|
||||
{
|
||||
Name = name,
|
||||
Version = version,
|
||||
Path = ReadString(value.Value("path"))
|
||||
});
|
||||
Version = version
|
||||
};
|
||||
|
||||
var pathValue = value.Value("path");
|
||||
projectLibrary.Path = pathValue == null ? null : ReadString(pathValue);
|
||||
|
||||
var buildTimeDependencyValue = value.Value("msbuildProject");
|
||||
projectLibrary.MSBuildProject = buildTimeDependencyValue == null ? null : ReadString(buildTimeDependencyValue);
|
||||
|
||||
lockFile.ProjectLibraries.Add(projectLibrary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an MSBuild project.
|
||||
/// It has been invisibly built by MSBuild, so it behaves like a package: can provide all assets up front
|
||||
///
|
||||
/// Path points to the project's directory
|
||||
/// MSBuildPRojectPath points to the csproj file
|
||||
/// </summary>
|
||||
public class MSBuildProjectDescription : TargetLibraryWithAssets
|
||||
{
|
||||
public MSBuildProjectDescription(
|
||||
string path,
|
||||
string msbuildProjectPath,
|
||||
LockFileProjectLibrary projectLibrary,
|
||||
LockFileTargetLibrary lockFileLibrary,
|
||||
Project projectFile,
|
||||
IEnumerable<LibraryRange> dependencies,
|
||||
bool compatible,
|
||||
bool resolved)
|
||||
: base(
|
||||
new LibraryIdentity(projectLibrary.Name, projectLibrary.Version, LibraryType.MSBuildProject),
|
||||
string.Empty, //msbuild projects don't have hashes
|
||||
path,
|
||||
lockFileLibrary,
|
||||
dependencies,
|
||||
resolved: resolved,
|
||||
compatible: compatible,
|
||||
framework: null)
|
||||
{
|
||||
MSBuildProjectPath = msbuildProjectPath;
|
||||
ProjectFile = projectFile;
|
||||
ProjectLibrary = projectLibrary;
|
||||
}
|
||||
|
||||
public LockFileProjectLibrary ProjectLibrary { get; }
|
||||
|
||||
public string MSBuildProjectPath { get; set; }
|
||||
|
||||
public Project ProjectFile { get; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
|
@ -9,7 +8,7 @@ using Microsoft.DotNet.ProjectModel.Resolution;
|
|||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
public class PackageDescription : LibraryDescription
|
||||
public class PackageDescription : TargetLibraryWithAssets
|
||||
{
|
||||
public PackageDescription(
|
||||
string path,
|
||||
|
@ -22,32 +21,22 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
new LibraryIdentity(package.Name, package.Version, LibraryType.Package),
|
||||
"sha512-" + package.Sha512,
|
||||
path,
|
||||
dependencies: dependencies,
|
||||
framework: null,
|
||||
lockFileLibrary,
|
||||
dependencies,
|
||||
resolved: resolved,
|
||||
compatible: compatible)
|
||||
compatible: compatible,
|
||||
framework: null)
|
||||
{
|
||||
Library = package;
|
||||
Target = lockFileLibrary;
|
||||
PackageLibrary = package;
|
||||
}
|
||||
|
||||
private LockFileTargetLibrary Target { get; }
|
||||
public LockFilePackageLibrary PackageLibrary { get; }
|
||||
|
||||
public LockFilePackageLibrary Library { get; }
|
||||
public override IEnumerable<LockFileItem> RuntimeAssemblies => FilterPlaceholders(base.RuntimeAssemblies);
|
||||
|
||||
public IEnumerable<LockFileItem> RuntimeAssemblies => FilterPlaceholders(Target.RuntimeAssemblies);
|
||||
public override IEnumerable<LockFileItem> CompileTimeAssemblies => FilterPlaceholders(base.CompileTimeAssemblies);
|
||||
|
||||
public IEnumerable<LockFileItem> CompileTimeAssemblies => FilterPlaceholders(Target.CompileTimeAssemblies);
|
||||
|
||||
public IEnumerable<LockFileItem> ResourceAssemblies => Target.ResourceAssemblies;
|
||||
|
||||
public IEnumerable<LockFileItem> NativeLibraries => Target.NativeLibraries;
|
||||
|
||||
public IEnumerable<LockFileContentFile> ContentFiles => Target.ContentFiles;
|
||||
|
||||
public IEnumerable<LockFileRuntimeTarget> RuntimeTargets => Target.RuntimeTargets;
|
||||
|
||||
private IEnumerable<LockFileItem> FilterPlaceholders(IList<LockFileItem> items)
|
||||
private static IEnumerable<LockFileItem> FilterPlaceholders(IEnumerable<LockFileItem> items)
|
||||
{
|
||||
return items.Where(a => !PackageDependencyProvider.IsPlaceholderFile(a));
|
||||
}
|
||||
|
|
|
@ -151,7 +151,11 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
.Where(t => t.TargetFramework.Equals(TargetFramework))
|
||||
.Any(t => !string.IsNullOrEmpty(t.RuntimeIdentifier));
|
||||
|
||||
var context = Create(ProjectFile.ProjectFilePath, TargetFramework, standalone ? runtimeIdentifiers : Enumerable.Empty<string>());
|
||||
var context = CreateBuilder(ProjectFile.ProjectFilePath, TargetFramework)
|
||||
.WithRuntimeIdentifiers(standalone ? runtimeIdentifiers : Enumerable.Empty<string>())
|
||||
.WithLockFile(LockFile)
|
||||
.Build();
|
||||
|
||||
if (standalone && context.RuntimeIdentifier == null)
|
||||
{
|
||||
// We are standalone, but don't support this runtime
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
@ -138,6 +139,8 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
|
||||
public ProjectContext Build()
|
||||
{
|
||||
var diagnostics = new List<DiagnosticMessage>();
|
||||
|
||||
ProjectDirectory = Project?.ProjectDirectory ?? ProjectDirectory;
|
||||
|
||||
if (GlobalSettings == null && ProjectDirectory != null)
|
||||
|
@ -159,7 +162,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
LockFileLookup lockFileLookup = null;
|
||||
EnsureProjectLoaded();
|
||||
|
||||
LockFile = LockFile ?? LockFileResolver(ProjectDirectory);
|
||||
ReadLockFile(diagnostics);
|
||||
|
||||
var validLockFile = true;
|
||||
string lockFileValidationMessage = null;
|
||||
|
@ -192,8 +195,9 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
target = SelectTarget(LockFile);
|
||||
if (target != null)
|
||||
{
|
||||
var packageResolver = new PackageDependencyProvider(PackagesDirectory, frameworkReferenceResolver);
|
||||
ScanLibraries(target, lockFileLookup, libraries, packageResolver, projectResolver);
|
||||
var nugetPackageResolver = new PackageDependencyProvider(PackagesDirectory, frameworkReferenceResolver);
|
||||
var msbuildProjectResolver = new MSBuildDependencyProvider(Project, ProjectResolver);
|
||||
ScanLibraries(target, lockFileLookup, libraries, msbuildProjectResolver, nugetPackageResolver, projectResolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,8 +207,6 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
// Resolve the dependencies
|
||||
ResolveDependencies(libraries, referenceAssemblyDependencyResolver, out requiresFrameworkAssemblies);
|
||||
|
||||
var diagnostics = new List<DiagnosticMessage>();
|
||||
|
||||
// REVIEW: Should this be in NuGet (possibly stored in the lock file?)
|
||||
if (LockFile == null)
|
||||
{
|
||||
|
@ -269,6 +271,51 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
LockFile);
|
||||
}
|
||||
|
||||
private void ReadLockFile(ICollection<DiagnosticMessage> diagnostics)
|
||||
{
|
||||
try
|
||||
{
|
||||
LockFile = LockFile ?? LockFileResolver(ProjectDirectory);
|
||||
}
|
||||
catch (FileFormatException e)
|
||||
{
|
||||
var lockFilePath = "";
|
||||
if (LockFile != null)
|
||||
{
|
||||
lockFilePath = LockFile.LockFilePath;
|
||||
}
|
||||
else if (Project != null)
|
||||
{
|
||||
lockFilePath = Path.Combine(Project.ProjectDirectory, LockFile.FileName);
|
||||
}
|
||||
|
||||
diagnostics.Add(new DiagnosticMessage(
|
||||
ErrorCodes.DOTNET1014,
|
||||
ComposeMessageFromInnerExceptions(e),
|
||||
lockFilePath,
|
||||
DiagnosticMessageSeverity.Error));
|
||||
}
|
||||
}
|
||||
|
||||
private static string ComposeMessageFromInnerExceptions(Exception exception)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var messages = new HashSet<string>();
|
||||
|
||||
while (exception != null)
|
||||
{
|
||||
messages.Add(exception.Message);
|
||||
exception = exception.InnerException;
|
||||
}
|
||||
|
||||
foreach (var message in messages)
|
||||
{
|
||||
sb.AppendLine(message);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void ResolveDependencies(Dictionary<LibraryKey, LibraryDescription> libraries,
|
||||
ReferenceAssemblyDependencyResolver referenceAssemblyDependencyResolver,
|
||||
out bool requiresFrameworkAssemblies)
|
||||
|
@ -342,7 +389,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
}
|
||||
}
|
||||
|
||||
private void ScanLibraries(LockFileTarget target, LockFileLookup lockFileLookup, Dictionary<LibraryKey, LibraryDescription> libraries, PackageDependencyProvider packageResolver, ProjectDependencyProvider projectDependencyProvider)
|
||||
private void ScanLibraries(LockFileTarget target, LockFileLookup lockFileLookup, Dictionary<LibraryKey, LibraryDescription> libraries, MSBuildDependencyProvider msbuildResolver, PackageDependencyProvider packageResolver, ProjectDependencyProvider projectResolver)
|
||||
{
|
||||
foreach (var library in target.Libraries)
|
||||
{
|
||||
|
@ -355,11 +402,18 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
|
||||
if (projectLibrary != null)
|
||||
{
|
||||
var path = Path.GetFullPath(Path.Combine(ProjectDirectory, projectLibrary.Path));
|
||||
description = projectDependencyProvider.GetDescription(library.Name, path, library, ProjectResolver);
|
||||
if (MSBuildDependencyProvider.IsMSBuildProjectLibrary(projectLibrary))
|
||||
{
|
||||
description = msbuildResolver.GetDescription(TargetFramework, projectLibrary, library);
|
||||
type = LibraryType.MSBuildProject;
|
||||
}
|
||||
else
|
||||
{
|
||||
var path = Path.GetFullPath(Path.Combine(ProjectDirectory, projectLibrary.Path));
|
||||
description = projectResolver.GetDescription(library.Name, path, library, ProjectResolver);
|
||||
type = LibraryType.Project;
|
||||
}
|
||||
}
|
||||
|
||||
type = LibraryType.Project;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||
{
|
||||
public class MSBuildDependencyProvider
|
||||
{
|
||||
private readonly Project _rootProject;
|
||||
private readonly Func<string, Project> _projectResolver;
|
||||
|
||||
public MSBuildDependencyProvider(Project rootProject, Func<string, Project> projectResolver)
|
||||
{
|
||||
_rootProject = rootProject;
|
||||
_projectResolver = projectResolver;
|
||||
}
|
||||
|
||||
public MSBuildProjectDescription GetDescription(NuGetFramework targetFramework, LockFileProjectLibrary projectLibrary, LockFileTargetLibrary targetLibrary)
|
||||
{
|
||||
var compatible = targetLibrary.FrameworkAssemblies.Any() ||
|
||||
targetLibrary.CompileTimeAssemblies.Any() ||
|
||||
targetLibrary.RuntimeAssemblies.Any();
|
||||
|
||||
var dependencies = new List<LibraryRange>(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count);
|
||||
PopulateDependencies(dependencies, targetLibrary, targetFramework);
|
||||
|
||||
var msbuildProjectFilePath = GetMSBuildProjectFilePath(projectLibrary);
|
||||
var msbuildProjectDirectoryPath = Path.GetDirectoryName(msbuildProjectFilePath);
|
||||
|
||||
var exists = Directory.Exists(msbuildProjectDirectoryPath);
|
||||
|
||||
var projectFile = projectLibrary.Path == null ? null : _projectResolver(projectLibrary.Path);
|
||||
|
||||
var msbuildPackageDescription = new MSBuildProjectDescription(
|
||||
msbuildProjectDirectoryPath,
|
||||
msbuildProjectFilePath,
|
||||
projectLibrary,
|
||||
targetLibrary,
|
||||
projectFile,
|
||||
dependencies,
|
||||
compatible,
|
||||
resolved: compatible && exists);
|
||||
|
||||
return msbuildPackageDescription;
|
||||
}
|
||||
|
||||
private string GetMSBuildProjectFilePath(LockFileProjectLibrary projectLibrary)
|
||||
{
|
||||
if (_rootProject == null)
|
||||
{
|
||||
throw new InvalidOperationException("Root xproj project does not exist. Cannot compute the path of its referenced csproj projects.");
|
||||
}
|
||||
|
||||
var rootProjectPath = Path.GetDirectoryName(_rootProject.ProjectFilePath);
|
||||
var msbuildProjectFilePath = Path.Combine(rootProjectPath, projectLibrary.MSBuildProject);
|
||||
|
||||
return Path.GetFullPath(msbuildProjectFilePath);
|
||||
}
|
||||
|
||||
private void PopulateDependencies(
|
||||
List<LibraryRange> dependencies,
|
||||
LockFileTargetLibrary targetLibrary,
|
||||
NuGetFramework targetFramework)
|
||||
{
|
||||
foreach (var dependency in targetLibrary.Dependencies)
|
||||
{
|
||||
dependencies.Add(new LibraryRange(
|
||||
dependency.Id,
|
||||
dependency.VersionRange,
|
||||
LibraryType.Unspecified,
|
||||
LibraryDependencyType.Default));
|
||||
}
|
||||
|
||||
if (!targetFramework.IsPackageBased)
|
||||
{
|
||||
// Only add framework assemblies for non-package based frameworks.
|
||||
foreach (var frameworkAssembly in targetLibrary.FrameworkAssemblies)
|
||||
{
|
||||
dependencies.Add(new LibraryRange(
|
||||
frameworkAssembly,
|
||||
LibraryType.ReferenceAssembly,
|
||||
LibraryDependencyType.Default));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsMSBuildProjectLibrary(LockFileProjectLibrary projectLibrary)
|
||||
{
|
||||
var msbuildProjectPath = projectLibrary.MSBuildProject;
|
||||
if (msbuildProjectPath == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var extension = Path.GetExtension(msbuildProjectPath);
|
||||
|
||||
return !string.Equals(extension, ".xproj", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
47
src/Microsoft.DotNet.ProjectModel/TargetLibraryWithAssets.cs
Normal file
47
src/Microsoft.DotNet.ProjectModel/TargetLibraryWithAssets.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
public abstract class TargetLibraryWithAssets : LibraryDescription
|
||||
{
|
||||
public TargetLibraryWithAssets(
|
||||
LibraryIdentity libraryIdentity,
|
||||
string sha512,
|
||||
string path,
|
||||
LockFileTargetLibrary lockFileLibrary,
|
||||
IEnumerable<LibraryRange> dependencies,
|
||||
bool compatible,
|
||||
bool resolved,
|
||||
NuGetFramework framework = null)
|
||||
: base(
|
||||
libraryIdentity,
|
||||
sha512,
|
||||
path,
|
||||
dependencies: dependencies,
|
||||
framework: null,
|
||||
resolved: resolved,
|
||||
compatible: compatible)
|
||||
{
|
||||
TargetLibrary = lockFileLibrary;
|
||||
}
|
||||
|
||||
private LockFileTargetLibrary TargetLibrary { get; }
|
||||
|
||||
public virtual IEnumerable<LockFileItem> RuntimeAssemblies => TargetLibrary.RuntimeAssemblies;
|
||||
|
||||
public virtual IEnumerable<LockFileItem> CompileTimeAssemblies => TargetLibrary.CompileTimeAssemblies;
|
||||
|
||||
public virtual IEnumerable<LockFileItem> ResourceAssemblies => TargetLibrary.ResourceAssemblies;
|
||||
|
||||
public virtual IEnumerable<LockFileItem> NativeLibraries => TargetLibrary.NativeLibraries;
|
||||
|
||||
public virtual IEnumerable<LockFileContentFile> ContentFiles => TargetLibrary.ContentFiles;
|
||||
|
||||
public virtual IEnumerable<LockFileRuntimeTarget> RuntimeTargets => TargetLibrary.RuntimeTargets;
|
||||
}
|
||||
}
|
|
@ -603,6 +603,11 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
}
|
||||
|
||||
compilerIO.Inputs.Add(project.LockFile.LockFilePath);
|
||||
|
||||
if (project.LockFile.ExportFile != null)
|
||||
{
|
||||
compilerIO.Inputs.Add(project.LockFile.ExportFile.ExportFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDependencies(ProjectDependenciesFacade dependencies, CompilerIO compilerIO)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Server.Helpers;
|
||||
using Microsoft.DotNet.ProjectModel.Server.Models;
|
||||
using Microsoft.DotNet.Cli.Compiler.Common;
|
||||
|
@ -51,15 +51,13 @@ namespace Microsoft.DotNet.ProjectModel.Server
|
|||
var description = DependencyDescription.Create(export.Library, diagnostics, allExports);
|
||||
allDependencies[description.Name] = description;
|
||||
|
||||
var projectDescription = export.Library as ProjectDescription;
|
||||
if (projectDescription != null)
|
||||
var projectReferene = ProjectReferenceDescription.Create(export.Library);
|
||||
if (projectReferene != null && export.Library.Identity.Name != context.ProjectFile.Name)
|
||||
{
|
||||
if (projectDescription.Identity.Name != context.ProjectFile.Name)
|
||||
{
|
||||
allProjectReferences.Add(ProjectReferenceDescription.Create(projectDescription));
|
||||
}
|
||||
allProjectReferences.Add(projectReferene);
|
||||
}
|
||||
else
|
||||
|
||||
if (export.Library.Identity.Type != LibraryType.Project)
|
||||
{
|
||||
allFileReferences.AddRange(export.CompilationAssemblies.Select(asset => asset.ResolvedPath));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Server.Helpers;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Server.Models
|
||||
{
|
||||
|
@ -24,7 +23,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
public string Type { get; private set; }
|
||||
|
||||
public bool Resolved { get; private set; }
|
||||
|
||||
|
||||
public IEnumerable<DependencyItem> Dependencies { get; private set; }
|
||||
|
||||
public IEnumerable<DiagnosticMessageView> Errors { get; private set; }
|
||||
|
@ -57,7 +56,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
List<DiagnosticMessage> diagnostics,
|
||||
IDictionary<string, LibraryExport> exportsLookup)
|
||||
{
|
||||
return new DependencyDescription
|
||||
var result = new DependencyDescription
|
||||
{
|
||||
Name = library.Identity.Name,
|
||||
DisplayName = library.Identity.Name,
|
||||
|
@ -71,6 +70,14 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
Warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning)
|
||||
.Select(d => new DiagnosticMessageView(d))
|
||||
};
|
||||
|
||||
var msbuildLibrary = library as MSBuildProjectDescription;
|
||||
if (msbuildLibrary != null)
|
||||
{
|
||||
result.Path = msbuildLibrary.MSBuildProjectPath;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static DependencyItem GetDependencyItem(LibraryRange dependency,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Server.Models
|
||||
{
|
||||
internal class ProjectReferenceDescription
|
||||
|
@ -12,44 +10,48 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
|
|||
public FrameworkData Framework { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string WrappedProjectPath { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var other = obj as ProjectReferenceDescription;
|
||||
return other != null &&
|
||||
string.Equals(Name, other.Name) &&
|
||||
string.Equals(Path, other.Path) &&
|
||||
string.Equals(WrappedProjectPath, other.WrappedProjectPath);
|
||||
string.Equals(Path, other.Path);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public static ProjectReferenceDescription Create(ProjectDescription description)
|
||||
|
||||
/// <summary>
|
||||
/// Create a ProjectReferenceDescription from given LibraryDescription. If the library doesn't
|
||||
/// represent a project reference returns null.
|
||||
/// </summary>
|
||||
public static ProjectReferenceDescription Create(LibraryDescription library)
|
||||
{
|
||||
var targetFrameworkInformation = description.TargetFrameworkInfo;
|
||||
|
||||
string wrappedProjectPath = null;
|
||||
if (!string.IsNullOrEmpty(targetFrameworkInformation?.WrappedProject) &&
|
||||
description.Project != null)
|
||||
if (library is ProjectDescription)
|
||||
{
|
||||
wrappedProjectPath = System.IO.Path.Combine(
|
||||
description.Project.ProjectDirectory,
|
||||
targetFrameworkInformation.WrappedProject);
|
||||
|
||||
wrappedProjectPath = System.IO.Path.GetFullPath(wrappedProjectPath);
|
||||
return new ProjectReferenceDescription
|
||||
{
|
||||
Framework = library.Framework.ToPayload(),
|
||||
Name = library.Identity.Name,
|
||||
Path = library.Path
|
||||
};
|
||||
}
|
||||
|
||||
return new ProjectReferenceDescription
|
||||
else if (library is MSBuildProjectDescription)
|
||||
{
|
||||
Framework = description.Framework.ToPayload(),
|
||||
Name = description.Identity.Name,
|
||||
Path = description.Path,
|
||||
WrappedProjectPath = wrappedProjectPath,
|
||||
};
|
||||
return new ProjectReferenceDescription
|
||||
{
|
||||
Framework = library.Framework.ToPayload(),
|
||||
Name = library.Identity.Name,
|
||||
Path = ((MSBuildProjectDescription)library).MSBuildProjectPath,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
var configuration = app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue);
|
||||
var projectPath = app.Argument("<PROJECT>", "The project to publish, defaults to the current directory. Can be a path to a project.json or a project directory");
|
||||
var nativeSubdirectories = app.Option("--native-subdirectory", "Temporary mechanism to include subdirectories from native assets of dependency packages in output", CommandOptionType.NoValue);
|
||||
var noBuild = app.Option("--no-build", "Do not build projects before publishing", CommandOptionType.NoValue);
|
||||
|
||||
app.OnExecute(() =>
|
||||
{
|
||||
|
@ -41,6 +42,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
publish.NativeSubdirectories = nativeSubdirectories.HasValue();
|
||||
publish.ProjectPath = projectPath.Value;
|
||||
publish.VersionSuffix = versionSuffix.Value();
|
||||
publish.ShouldBuild = !noBuild.HasValue();
|
||||
|
||||
if (string.IsNullOrEmpty(publish.ProjectPath))
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
public string VersionSuffix { get; set; }
|
||||
public int NumberOfProjects { get; private set; }
|
||||
public int NumberOfPublishedProjects { get; private set; }
|
||||
public bool ShouldBuild { get; set; }
|
||||
|
||||
public bool TryPrepareForPublish()
|
||||
{
|
||||
|
@ -119,34 +120,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
}
|
||||
|
||||
// Compile the project (and transitively, all it's dependencies)
|
||||
var args = new List<string>() {
|
||||
"--framework",
|
||||
$"{context.TargetFramework.DotNetFrameworkName}",
|
||||
"--configuration",
|
||||
configuration,
|
||||
context.ProjectFile.ProjectDirectory
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(context.RuntimeIdentifier))
|
||||
{
|
||||
args.Insert(0, context.RuntimeIdentifier);
|
||||
args.Insert(0, "--runtime");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(VersionSuffix))
|
||||
{
|
||||
args.Add("--version-suffix");
|
||||
args.Add(VersionSuffix);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(buildBasePath))
|
||||
{
|
||||
args.Add("--build-base-path");
|
||||
args.Add(buildBasePath);
|
||||
}
|
||||
|
||||
var result = Build.BuildCommand.Run(args.ToArray());
|
||||
if (result != 0)
|
||||
if (ShouldBuild && !InvokeBuildOnProject(context, buildBasePath, configuration))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -206,6 +180,40 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool InvokeBuildOnProject(ProjectContext context, string buildBasePath, string configuration)
|
||||
{
|
||||
var args = new List<string>()
|
||||
{
|
||||
"--framework",
|
||||
$"{context.TargetFramework.DotNetFrameworkName}",
|
||||
"--configuration",
|
||||
configuration,
|
||||
context.ProjectFile.ProjectDirectory
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(context.RuntimeIdentifier))
|
||||
{
|
||||
args.Insert(0, context.RuntimeIdentifier);
|
||||
args.Insert(0, "--runtime");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(VersionSuffix))
|
||||
{
|
||||
args.Add("--version-suffix");
|
||||
args.Add(VersionSuffix);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(buildBasePath))
|
||||
{
|
||||
args.Add("--build-base-path");
|
||||
args.Add(buildBasePath);
|
||||
}
|
||||
|
||||
var result = Build.BuildCommand.Run(args.ToArray());
|
||||
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
private HashSet<string> GetExclusionList(ProjectContext context, Dictionary<string, LibraryExport> exports)
|
||||
{
|
||||
var exclusionList = new HashSet<string>();
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using NuGet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Tests
|
||||
{
|
||||
public class LockFilePatchingTests : TestBase
|
||||
{
|
||||
|
||||
private static string ExportFilesRoot=> Path.Combine(RepoRoot, "TestAssets", "LockFiles", "ExportFiles");
|
||||
|
||||
[Fact]
|
||||
public void TestExportFileIsParsed()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("valid");
|
||||
var lockFile = LockFileReader.Read(lockFilePath);
|
||||
|
||||
var exportFile = lockFile.ExportFile;
|
||||
|
||||
exportFile.Should().NotBeNull();
|
||||
exportFile.Exports.Count.Should().Be(3);
|
||||
exportFile.Exports.Should().OnlyHaveUniqueItems();
|
||||
|
||||
// check export structure
|
||||
foreach (var export in exportFile.Exports)
|
||||
{
|
||||
export.TargetFramework.Should().NotBeNull();
|
||||
AssertTargetLibrary(export);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestLockFileIsPatchedWithExportData()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("valid");
|
||||
var lockFile = LockFileReader.Read(lockFilePath);
|
||||
|
||||
// check lock file structure is similar to export structure
|
||||
foreach (var target in lockFile.Targets)
|
||||
{
|
||||
target.Libraries.Count.Should().Be(3);
|
||||
|
||||
foreach (var library in target.Libraries)
|
||||
{
|
||||
AssertTargetLibrary(library);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFragmentExistsButNoHolesInLockFile()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("valid_staleFragment");
|
||||
var lockFile = LockFileReader.Read(lockFilePath);
|
||||
|
||||
var exportFile = lockFile.ExportFile;
|
||||
|
||||
exportFile.Should().BeNull();
|
||||
|
||||
lockFile.Targets.Count.Should().Be(1);
|
||||
|
||||
lockFile.Targets[0].Libraries.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMissingExportFileThrows()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("invalid_nofragment");
|
||||
|
||||
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMissingExportsThrow()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("invalid_missing-exports");
|
||||
|
||||
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestMissmatchingFileVersionsThrows()
|
||||
{
|
||||
var lockFilePath = GetLockFilePath("invalid_missmatching-versions");
|
||||
|
||||
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath));
|
||||
}
|
||||
|
||||
private static int LibraryNumberFromName(Microsoft.DotNet.ProjectModel.Graph.LockFileTargetLibrary library)
|
||||
{
|
||||
var libraryName = library.Name;
|
||||
return (int)char.GetNumericValue(libraryName[libraryName.Length - 1]);
|
||||
}
|
||||
|
||||
private static void AssertTargetLibrary(Microsoft.DotNet.ProjectModel.Graph.LockFileTargetLibrary library)
|
||||
{
|
||||
var libraryNumber = LibraryNumberFromName(library);
|
||||
|
||||
library.Type.Should().Be("project");
|
||||
|
||||
library.Name.Should().Be("ClassLibrary" + libraryNumber);
|
||||
library.Version.ToNormalizedString().Should().Be("1.0.0");
|
||||
|
||||
var dll = $"bin/Debug/ClassLibrary{libraryNumber}.dll";
|
||||
dll = dll.Replace('/', Path.DirectorySeparatorChar);
|
||||
|
||||
library.CompileTimeAssemblies.Count.Should().Be(1);
|
||||
library.CompileTimeAssemblies.ElementAt(0).Path.Should().Be(dll);
|
||||
|
||||
library.RuntimeAssemblies.Count.Should().Be(1);
|
||||
library.RuntimeAssemblies.ElementAt(0).Path.Should().Be(dll);
|
||||
}
|
||||
|
||||
private static string GetLockFilePath(string exportSample)
|
||||
{
|
||||
return Path.Combine(ExportFilesRoot, exportSample, "project.lock.json");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,9 +19,10 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
private readonly string _framework;
|
||||
private readonly string _runtime;
|
||||
private readonly string _config;
|
||||
private readonly bool _noBuild;
|
||||
private readonly string _output;
|
||||
|
||||
public PublishCommand(string projectPath, string framework = "", string runtime = "", string output = "", string config = "", bool forcePortable = false)
|
||||
public PublishCommand(string projectPath, string framework = "", string runtime = "", string output = "", string config = "", bool forcePortable = false, bool noBuild = false)
|
||||
: base("dotnet")
|
||||
{
|
||||
_path = projectPath;
|
||||
|
@ -30,6 +31,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
_runtime = runtime;
|
||||
_output = output;
|
||||
_config = config;
|
||||
_noBuild = noBuild;
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
|
@ -91,12 +93,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return $"{_path} {FrameworkOption} {RuntimeOption} {OutputOption} {ConfigOption}";
|
||||
return $"{_path} {FrameworkOption} {RuntimeOption} {OutputOption} {ConfigOption} {NoBuildFlag}";
|
||||
}
|
||||
|
||||
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
||||
private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}";
|
||||
private string OutputOption => string.IsNullOrEmpty(_output) ? "" : $"-o \"{_output}\"";
|
||||
private string ConfigOption => string.IsNullOrEmpty(_config) ? "" : $"-c {_output}";
|
||||
private string NoBuildFlag => _noBuild ? "--no-build" :"";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -148,8 +149,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
.AssertJArrayCount(1)
|
||||
.RetrieveArraryElementAs<JObject>(0)
|
||||
.AssertProperty("Name", expectedUnresolvedDependency)
|
||||
.AssertProperty("Path", expectedUnresolvedProjectPath)
|
||||
.AssertProperty<JToken>("WrappedProjectPath", prop => !prop.HasValues);
|
||||
.AssertProperty("Path", expectedUnresolvedProjectPath);
|
||||
}
|
||||
else if (referenceType == "Package")
|
||||
{
|
||||
|
@ -412,5 +412,64 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MSBuildReferenceTest()
|
||||
{
|
||||
var testProject = Path.Combine(RepoRoot, "TestAssets",
|
||||
"ProjectModelServer",
|
||||
"MSBuildReferencesProjects",
|
||||
"ValidCase01",
|
||||
"src",
|
||||
"MainApp");
|
||||
|
||||
using (var server = new DthTestServer(_loggerFactory))
|
||||
using (var client = new DthTestClient(server, _loggerFactory))
|
||||
{
|
||||
client.Initialize(testProject);
|
||||
var messages = client.DrainAllMessages();
|
||||
|
||||
var classLibraries = new HashSet<string>(new string[] { "ClassLibrary1", "ClassLibrary2", "ClassLibrary3" });
|
||||
var dependencies = messages.RetrieveSingleMessage(MessageTypes.Dependencies);
|
||||
var testProjectRoot = Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer", "MSBuildReferencesProjects", "ValidCase01");
|
||||
foreach (var classLibrary in classLibraries)
|
||||
{
|
||||
dependencies.RetrieveDependency(classLibrary)
|
||||
.AssertProperty("Type", LibraryType.MSBuildProject.ToString())
|
||||
.AssertProperty("Path", NormalizePathString(Path.Combine(testProjectRoot, classLibrary, $"{classLibrary}.csproj")))
|
||||
.AssertProperty<bool>("Resolved", true)
|
||||
.AssertProperty("Name", classLibrary)
|
||||
.AssertProperty<JArray>("Errors", array => array.Count == 0)
|
||||
.AssertProperty<JArray>("Warnings", array => array.Count == 0);
|
||||
}
|
||||
|
||||
var references = messages.RetrieveSingleMessage(MessageTypes.References)
|
||||
.RetrievePayloadAs<JObject>();
|
||||
|
||||
var projectReferences = references.RetrievePropertyAs<JArray>("ProjectReferences");
|
||||
Assert.Equal(3, projectReferences.Count);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
var projectRef = projectReferences.RetrieveArraryElementAs<JObject>(i);
|
||||
var name = projectRef["Name"].Value<string>();
|
||||
|
||||
Assert.True(classLibraries.Contains(name));
|
||||
projectRef.AssertProperty("Path", NormalizePathString(Path.Combine(testProjectRoot, name, $"{name}.csproj")));
|
||||
}
|
||||
|
||||
var fileReferences = references.RetrievePropertyAs<JArray>("FileReferences")
|
||||
.Select(each => each.Value<string>())
|
||||
.ToArray();
|
||||
foreach (var each in classLibraries)
|
||||
{
|
||||
fileReferences.Contains(Path.Combine("ValidCase01", "ClassLibrary1", "bin", "Debug", $"{each}.dll"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string NormalizePathString(string original)
|
||||
{
|
||||
return original.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,31 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
publishCommand.Execute().Should().Fail();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublishFailsWhenProjectNotBuiltAndNoBuildFlagSet()
|
||||
{
|
||||
TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppCompilationContext")
|
||||
.WithLockFiles();
|
||||
|
||||
var testProject = _getProjectJson(instance.TestRoot, "TestApp");
|
||||
var publishCommand = new PublishCommand(testProject, noBuild: true);
|
||||
|
||||
publishCommand.Execute().Should().Fail();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublishSucceedsWhenProjectPreviouslyCompiledAndNoBuildFlagSet()
|
||||
{
|
||||
TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppCompilationContext")
|
||||
.WithLockFiles()
|
||||
.WithBuildArtifacts();
|
||||
|
||||
var testProject = _getProjectJson(instance.TestRoot, "TestApp");
|
||||
var publishCommand = new PublishCommand(testProject, noBuild: true);
|
||||
|
||||
publishCommand.Execute().Should().Pass();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublishScriptsRun()
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
{
|
||||
if (export.Library.Identity.Type == LibraryType.Package)
|
||||
{
|
||||
var runtimeJson = ((PackageDescription) export.Library).Library.Files.FirstOrDefault(f => f == RuntimeJsonFileName);
|
||||
var runtimeJson = ((PackageDescription) export.Library).PackageLibrary.Files.FirstOrDefault(f => f == RuntimeJsonFileName);
|
||||
if (runtimeJson != null)
|
||||
{
|
||||
var runtimeJsonFullName = Path.Combine(export.Library.Path, runtimeJson);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue