Skip to content

Commit 22f2eed

Browse files
sailroGitHub Enterprise
authored andcommitted
Merge pull request #184 from unity/private-references
Do not copy referenced assemblies to output folder
2 parents 74e4a20 + 8f1d3e5 commit 22f2eed

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Packages/com.unity.ide.visualstudio.tests/Tests/Editor/CSProjectTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ public void DllInSourceFiles_WillBeAddedAsReference()
907907
XmlDocument scriptProject = XMLUtilities.FromText(csprojFileContents);
908908
XMLUtilities.AssertCompileItemsMatchExactly(scriptProject, new[] { "file.cs" });
909909
XMLUtilities.AssertNonCompileItemsMatchExactly(scriptProject, new string[0]);
910-
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"reference\">\\W*<HintPath>{referenceDll}\\W*</HintPath>\\W*</Reference>"));
910+
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"reference\">\\W*<HintPath>{referenceDll}\\W*</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
911911
}
912912

913913
[Test]
@@ -922,7 +922,7 @@ public void Containing_PathWithSpaces_IsParsedCorrectly()
922922
synchronizer.Sync();
923923

924924
var csprojFileContents = m_Builder.ReadProjectFile(m_Builder.Assembly);
925-
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"Goodbye\">\\W*<HintPath>{Regex.Escape(fullPathReferences[0].ReplaceDirectorySeparators())}\\W*</HintPath>\\W*</Reference>"));
925+
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"Goodbye\">\\W*<HintPath>{Regex.Escape(fullPathReferences[0].ReplaceDirectorySeparators())}\\W*</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
926926
}
927927

928928
[Test]
@@ -951,8 +951,8 @@ public void Multiple_AreAdded()
951951

952952
var csprojFileContents = m_Builder.ReadProjectFile(m_Builder.Assembly);
953953

954-
Assert.IsTrue(csprojFileContents.MatchesRegex("<Reference Include=\"Hello\">\\W*<HintPath>Hello.dll</HintPath>\\W*</Reference>"));
955-
Assert.IsTrue(csprojFileContents.MatchesRegex("<Reference Include=\"MyPlugin\">\\W*<HintPath>MyPlugin.dll</HintPath>\\W*</Reference>"));
954+
Assert.IsTrue(csprojFileContents.MatchesRegex("<Reference Include=\"Hello\">\\W*<HintPath>Hello.dll</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
955+
Assert.IsTrue(csprojFileContents.MatchesRegex("<Reference Include=\"MyPlugin\">\\W*<HintPath>MyPlugin.dll</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
956956
}
957957

958958
[Test]
@@ -989,8 +989,8 @@ public void AssemblyReferenceFromInternalizedPackage_IsAddedAsReference()
989989
var csprojFileContents = m_Builder.ReadProjectFile(m_Builder.Assembly);
990990
Assert.That(csprojFileContents, Does.Not.Match($@"<ProjectReference Include=""{assemblyReferences[0].name}\.csproj"">[\S\s]*?</ProjectReference>"));
991991
Assert.That(csprojFileContents, Does.Not.Match($@"<ProjectReference Include=""{assemblyReferences[1].name}\.csproj"">[\S\s]*?</ProjectReference>"));
992-
Assert.That(csprojFileContents, Does.Match($"<Reference Include=\"{assemblyReferences[0].name}\">\\W*<HintPath>{Regex.Escape(assemblyReferences[0].outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*</Reference>"));
993-
Assert.That(csprojFileContents, Does.Match($"<Reference Include=\"{assemblyReferences[1].name}\">\\W*<HintPath>{Regex.Escape(assemblyReferences[1].outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*</Reference>"));
992+
Assert.That(csprojFileContents, Does.Match($"<Reference Include=\"{assemblyReferences[0].name}\">\\W*<HintPath>{Regex.Escape(assemblyReferences[0].outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
993+
Assert.That(csprojFileContents, Does.Match($"<Reference Include=\"{assemblyReferences[1].name}\">\\W*<HintPath>{Regex.Escape(assemblyReferences[1].outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
994994
}
995995

996996
[Test]
@@ -1006,8 +1006,8 @@ public void CompiledAssemblyReference_IsAdded()
10061006
synchronizer.Sync();
10071007

10081008
var csprojFileContents = m_Builder.ReadProjectFile(m_Builder.Assembly);
1009-
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"Hello\">\\W*<HintPath>{Regex.Escape(compiledAssemblyReferences[0])}</HintPath>\\W*</Reference>"));
1010-
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"MyPlugin\">\\W*<HintPath>{Regex.Escape(compiledAssemblyReferences[1])}</HintPath>\\W*</Reference>"));
1009+
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"Hello\">\\W*<HintPath>{Regex.Escape(compiledAssemblyReferences[0])}</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
1010+
Assert.IsTrue(csprojFileContents.MatchesRegex($"<Reference Include=\"MyPlugin\">\\W*<HintPath>{Regex.Escape(compiledAssemblyReferences[1])}</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
10111011
}
10121012

10131013
[Test]
@@ -1019,7 +1019,7 @@ public void ProjectReference_FromLibraryReferences_IsAdded()
10191019
synchronizer.Sync();
10201020

10211021
var csprojFileContents = m_Builder.ReadProjectFile(m_Builder.Assembly);
1022-
Assert.IsFalse(csprojFileContents.MatchesRegex($"<Reference Include=\"{projectAssembly.name}\">\\W*<HintPath>{Regex.Escape(projectAssembly.outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*</Reference>"));
1022+
Assert.IsFalse(csprojFileContents.MatchesRegex($"<Reference Include=\"{projectAssembly.name}\">\\W*<HintPath>{Regex.Escape(projectAssembly.outputPath.ReplaceDirectorySeparators())}</HintPath>\\W*<Private>False</Private>\\W*</Reference>"));
10231023
}
10241024

10251025
[Test]

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/ProjectGeneration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ private void AppendReference(string fullReference, StringBuilder projectBuilder)
588588
var escapedFullPath = EscapedRelativePathFor(fullReference, out _);
589589
projectBuilder.Append(@" <Reference Include=""").Append(Path.GetFileNameWithoutExtension(escapedFullPath)).Append(@""">").Append(k_WindowsNewline);
590590
projectBuilder.Append(" <HintPath>").Append(escapedFullPath).Append("</HintPath>").Append(k_WindowsNewline);
591+
projectBuilder.Append(" <Private>False</Private>").Append(k_WindowsNewline);
591592
projectBuilder.Append(" </Reference>").Append(k_WindowsNewline);
592593
}
593594

0 commit comments

Comments
 (0)