diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/.gitignore b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/.gitignore new file mode 100644 index 000000000..497f0e325 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/.gitignore @@ -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 diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Class1.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Class1.cs new file mode 100644 index 000000000..08281c64a --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Class1.cs @@ -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 + { + } +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/ClassLibrary1.csproj b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 000000000..7364cb64d --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {FD073258-550B-4E57-86AE-DC4874015EB1} + Library + Properties + ClassLibrary1 + ClassLibrary1 + v4.5.2 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + True + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Properties/AssemblyInfo.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..6437643a7 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/Properties/AssemblyInfo.cs @@ -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")] diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/packages.config b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/packages.config new file mode 100644 index 000000000..1975352b1 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary1/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Class1.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Class1.cs new file mode 100644 index 000000000..ad2fff55e --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Class1.cs @@ -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 + { + } +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/ClassLibrary2.csproj b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/ClassLibrary2.csproj new file mode 100644 index 000000000..fb17ee317 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/ClassLibrary2.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + 0f2d2a48-e867-496c-85a7-e97b64cfeda4 + Library + Properties + ClassLibrary2 + ClassLibrary2 + v4.6 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Properties/AssemblyInfo.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b40cfab4c --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary2/Properties/AssemblyInfo.cs @@ -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")] diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Class1.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Class1.cs new file mode 100644 index 000000000..21384c5b2 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Class1.cs @@ -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 + { + } +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/ClassLibrary3.csproj b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/ClassLibrary3.csproj new file mode 100644 index 000000000..0bcde3dfe --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/ClassLibrary3.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + 428e95cb-8435-414b-a313-9d734c633b3e + Library + Properties + ClassLibrary3 + ClassLibrary3 + v4.6 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Properties/AssemblyInfo.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..0eadf724e --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ClassLibrary3/Properties/AssemblyInfo.cs @@ -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")] diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ConsoleApp13.sln b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ConsoleApp13.sln new file mode 100644 index 000000000..1ac8ff099 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/ConsoleApp13.sln @@ -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 diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/global.json b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/global.json new file mode 100644 index 000000000..5e6422e6d --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "src", "test" ] +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/ConsoleApp13.xproj b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/ConsoleApp13.xproj new file mode 100644 index 000000000..ec559dc46 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/ConsoleApp13.xproj @@ -0,0 +1,24 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 767d3038-ac3a-4722-b21f-f85f2cbc3aa3 + ConsoleApp13 + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\ + v4.6 + + + 2.0 + + + + + + + + \ No newline at end of file diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Program.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Program.cs new file mode 100644 index 000000000..6723332b1 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Program.cs @@ -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(); + } + } +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Properties/AssemblyInfo.cs b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..83e8803f8 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/Properties/AssemblyInfo.cs @@ -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")] diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.fragment.lock.json b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.fragment.lock.json new file mode 100644 index 000000000..1efff4670 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.fragment.lock.json @@ -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": {} + } + } + } +} \ No newline at end of file diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.json b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.json new file mode 100644 index 000000000..1323d5f29 --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.json @@ -0,0 +1,22 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "frameworks": { + "net46": { + "dependencies": { + "ClassLibrary1": { + "target": "project" + }, + "ClassLibrary2": { + "target": "project" + }, + "ClassLibrary3": { + "target": "project" + } + } + } + } +} diff --git a/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.lock.json b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.lock.json new file mode 100644 index 000000000..244c3771b --- /dev/null +++ b/TestAssets/ProjectModelServer/MSBuildReferencesProjects/BasicCase01/src/ConsoleApp13/project.lock.json @@ -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" + ] + } +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectModel/MSBuildProjectDescription.cs b/src/Microsoft.DotNet.ProjectModel/MSBuildProjectDescription.cs index 4209c0802..f36e57f00 100644 --- a/src/Microsoft.DotNet.ProjectModel/MSBuildProjectDescription.cs +++ b/src/Microsoft.DotNet.ProjectModel/MSBuildProjectDescription.cs @@ -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; diff --git a/src/Microsoft.DotNet.ProjectModel/PackageDescription.cs b/src/Microsoft.DotNet.ProjectModel/PackageDescription.cs index 3aebd3409..b52e0aa54 100644 --- a/src/Microsoft.DotNet.ProjectModel/PackageDescription.cs +++ b/src/Microsoft.DotNet.ProjectModel/PackageDescription.cs @@ -1,12 +1,10 @@ // 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.IO; using System.Collections.Generic; using System.Linq; using Microsoft.DotNet.ProjectModel.Graph; using Microsoft.DotNet.ProjectModel.Resolution; -using System; namespace Microsoft.DotNet.ProjectModel { diff --git a/src/dotnet/commands/dotnet-projectmodel-server/InternalModels/ProjectContextSnapshot.cs b/src/dotnet/commands/dotnet-projectmodel-server/InternalModels/ProjectContextSnapshot.cs index 684d2e403..694d2ef93 100644 --- a/src/dotnet/commands/dotnet-projectmodel-server/InternalModels/ProjectContextSnapshot.cs +++ b/src/dotnet/commands/dotnet-projectmodel-server/InternalModels/ProjectContextSnapshot.cs @@ -4,11 +4,11 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.DotNet.ProjectModel.Compilation; using Microsoft.DotNet.ProjectModel.Server.Helpers; using Microsoft.DotNet.ProjectModel.Server.Models; using Microsoft.DotNet.Cli.Compiler.Common; using NuGet.Frameworks; +using Microsoft.DotNet.ProjectModel.Graph; namespace Microsoft.DotNet.ProjectModel.Server { @@ -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)); } diff --git a/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs b/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs index c30be87d9..9b8e95011 100644 --- a/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs +++ b/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs @@ -5,13 +5,12 @@ 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 { public class DependencyDescription { - private DependencyDescription() { } + protected DependencyDescription() { } public string Name { get; private set; } @@ -24,6 +23,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models public string Type { get; private set; } public bool Resolved { get; private set; } + + public string MSBuildProjectPath { get; private set; } public IEnumerable Dependencies { get; private set; } @@ -57,7 +58,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models List diagnostics, IDictionary exportsLookup) { - return new DependencyDescription + var result = new DependencyDescription { Name = library.Identity.Name, DisplayName = library.Identity.Name, @@ -71,6 +72,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.MSBuildProjectPath = msbuildLibrary.ProjectLibrary.MSBuildProject; + } + + return result; } private static DependencyItem GetDependencyItem(LibraryRange dependency, diff --git a/src/dotnet/commands/dotnet-projectmodel-server/Models/ProjectReferenceDescription.cs b/src/dotnet/commands/dotnet-projectmodel-server/Models/ProjectReferenceDescription.cs index b0cb6ffc0..24bc4e263 100644 --- a/src/dotnet/commands/dotnet-projectmodel-server/Models/ProjectReferenceDescription.cs +++ b/src/dotnet/commands/dotnet-projectmodel-server/Models/ProjectReferenceDescription.cs @@ -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,7 +10,7 @@ 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 string MSBuildProjectPath { get; set; } public override bool Equals(object obj) { @@ -20,36 +18,43 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models return other != null && string.Equals(Name, other.Name) && string.Equals(Path, other.Path) && - string.Equals(WrappedProjectPath, other.WrappedProjectPath); + string.Equals(MSBuildProjectPath, other.MSBuildProjectPath); } public override int GetHashCode() { return base.GetHashCode(); } - - public static ProjectReferenceDescription Create(ProjectDescription description) + + /// + /// Create a ProjectReferenceDescription from given LibraryDescription. If the library doesn't + /// represent a project reference returns null. + /// + 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 = library.Path, + MSBuildProjectPath = ((MSBuildProjectDescription)library).ProjectLibrary.MSBuildProject + }; + } + else + { + return null; + } } } } diff --git a/test/dotnet-projectmodel-server.Tests/DthTests.cs b/test/dotnet-projectmodel-server.Tests/DthTests.cs index 1d10084ab..90e8805e9 100644 --- a/test/dotnet-projectmodel-server.Tests/DthTests.cs +++ b/test/dotnet-projectmodel-server.Tests/DthTests.cs @@ -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; @@ -149,7 +150,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests .RetrieveArraryElementAs(0) .AssertProperty("Name", expectedUnresolvedDependency) .AssertProperty("Path", expectedUnresolvedProjectPath) - .AssertProperty("WrappedProjectPath", prop => !prop.HasValues); + .AssertProperty("MSBuildProjectPath", prop => !prop.HasValues); } else if (referenceType == "Package") { @@ -412,5 +413,60 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests } } } + + [Fact] + public void MSBuildReferenceTest() + { + var testProject = Path.Combine(RepoRoot, "TestAssets", + "ProjectModelServer", + "MSBuildReferencesProjects", + "BasicCase01", + "src", + "ConsoleApp13"); + + using (var server = new DthTestServer(_loggerFactory)) + using (var client = new DthTestClient(server, _loggerFactory)) + { + client.Initialize(testProject); + var messages = client.DrainAllMessages(); + + var classLibraries = new HashSet(new string[] { "ClassLibrary1", "ClassLibrary2", "ClassLibrary3" }); + var dependencies = messages.RetrieveSingleMessage(MessageTypes.Dependencies); + foreach (var each in classLibraries) + { + dependencies.RetrieveDependency(each) + .AssertProperty("Type", LibraryType.MSBuildProject.ToString()) + .AssertProperty("MSBuildProjectPath", Path.Combine("..", "..", each, $"{each}.csproj")) + .AssertProperty("Resolved", true) + .AssertProperty("Name", each) + .AssertProperty("Errors", array => array.Count == 0) + .AssertProperty("Warnings", array => array.Count == 0); + } + + var references = messages.RetrieveSingleMessage(MessageTypes.References) + .RetrievePayloadAs(); + + var projectReferences = references.RetrievePropertyAs("ProjectReferences"); + Assert.Equal(3, projectReferences.Count); + for (int i = 0; i < 3; ++i) + { + var projectRef = projectReferences.RetrieveArraryElementAs(i); + var name = projectRef["Name"].Value(); + + Assert.True(classLibraries.Contains(name)); + projectRef.AssertProperty("Path", path => path.Contains(Path.Combine("BasicCase01", name))) + .AssertProperty("MSBuildProjectPath", Path.Combine("..", "..", name, $"{name}.csproj")); + } + + var fileReferences = references.RetrievePropertyAs("FileReferences") + .Select(each => each.Value()) + .ToArray(); + Assert.Equal(3, fileReferences.Length); + foreach (var each in classLibraries) + { + fileReferences.Contains(Path.Combine("BasicCase01", "ClassLibrary1", "bin", "Debug", $"{each}.dll")); + } + } + } } }