From f713eec5f14d6b2bff706b113f15e7b1db2d48db Mon Sep 17 00:00:00 2001 From: Alexander Chirlin Date: Mon, 18 Feb 2019 20:10:04 +0200 Subject: [PATCH] #80260, Relax conditions for NSubstitute, greater or equal to 3.1 --- .paket/set.copy.local.false.libs.linq | 67 +++++++++++++++++++ .../Gigya.Microdot.Orleans.Hosting.csproj | 44 ++++++------ Microdot.sln | 3 +- .../CalculatorService.Orleans.csproj | 44 ++++++------ SolutionVersion.cs | 6 +- paket.dependencies | 2 +- paket.lock | 4 +- .../Gigya.Microdot.Hosting.UnitTests.csproj | 44 ++++++------ ....Microdot.Orleans.Hosting.UnitTests.csproj | 44 ++++++------ 9 files changed, 163 insertions(+), 95 deletions(-) create mode 100644 .paket/set.copy.local.false.libs.linq diff --git a/.paket/set.copy.local.false.libs.linq b/.paket/set.copy.local.false.libs.linq new file mode 100644 index 00000000..7096a161 --- /dev/null +++ b/.paket/set.copy.local.false.libs.linq @@ -0,0 +1,67 @@ + + Gigya.Build.Solo + Gigya.Build.Solo + Gigya.Build.Solo.Command + + +// +// Run, to stop visual studio complile projects again and again. +// 1.0.2 +// A.Chirlin, 2019/02/16 +// +// Since upgrade to 4.7.2 there is negative impact on compilation time, VS recompiles again and again the projects despite absence of changes. +// Such behavior is result of facade (design time references) not actually copied to bin, but recognized as missing and triggering rebuild. +// More about how I found this behavior in: https://michaelscodingspot.com/2017/04/28/visual-studio-keeps-rebuilding-projects-no-good-reason/ +// +// Why script? +// Every time you running paket install, ooops the properties will be rewritten. +// + +var scriptDir = Path.GetDirectoryName(Util.CurrentQueryPath); +var filesTxt = Path.GetFileNameWithoutExtension(Util.CurrentQueryPath) + ".txt"; +var slnFile = new FileInfo(Path.Combine(scriptDir, "..", "Microdot.sln")).FullName; + +var s = new Solution(slnFile); +var designTime = @"c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades"; +var affected = new List(); +var exclude = new[]{"System.ValueTuple", "System.ComponentModel.Annotations"}; // I paid attention, for some reason these are still copied, despite is it design time + +foreach (var project in s.Projects.OrderBy(p=>p.FullName)) +{ + // load project XML + var xmlDoc = new XmlDocument(); + var projectFile = project.FullName; + xmlDoc.Load(projectFile); + var ns = xmlDoc.DocumentElement.Attributes["xmlns"].InnerText; + var mgr = new XmlNamespaceManager(xmlDoc.NameTable); + mgr.AddNamespace("a", ns); + + // Find all references with Private = True (meaning copy local true). + // If this reference in design time folder, meaning msbuild won't copy it despite copy local true AND it causing rebuild (as not found in output folder). + // Such reference apparently has no meaning of copy local and we can convert to False. + // I found few exceptions from rule above, that despite the reference resides in design time (facade) folder, it is still copied by msbuild. Why? It is same name and public key token ... + // So far, I narrowed the assemblies to System.* nuget packages and installed by paket only. + var hasChanges = false; + foreach (XmlAttribute element in xmlDoc.SelectNodes(@"//a:Reference[a:Private[.='True'] and a:Paket[.='True']]/@Include[starts-with(.,'System.')]", mgr)) + { + var reference = element.Value; + + if(!exclude.Contains(reference)) + if (File.Exists(Path.Combine(designTime, reference + ".dll"))) + { + var @private = element.OwnerElement.SelectSingleNode("a:Private[.='True']", mgr); + @private.InnerText = "False"; + hasChanges = true; + affected.Add(reference); + } + } + + if (hasChanges) + { + xmlDoc.Save(projectFile); + projectFile.Dump(); + } +} + +affected.Distinct().OrderBy(r=>r).ToList().Dump("Affected references:"); +exclude.Dump("Excluded references:"); \ No newline at end of file diff --git a/Gigya.Microdot.Orleans.Hosting/Gigya.Microdot.Orleans.Hosting.csproj b/Gigya.Microdot.Orleans.Hosting/Gigya.Microdot.Orleans.Hosting.csproj index 378b8c61..9ecee65c 100644 --- a/Gigya.Microdot.Orleans.Hosting/Gigya.Microdot.Orleans.Hosting.csproj +++ b/Gigya.Microdot.Orleans.Hosting/Gigya.Microdot.Orleans.Hosting.csproj @@ -257,7 +257,7 @@ ..\packages\System.AppContext\lib\net463\System.AppContext.dll - True + False True @@ -279,7 +279,7 @@ ..\packages\System.Console\lib\net46\System.Console.dll - True + False True @@ -290,7 +290,7 @@ ..\packages\System.Diagnostics.FileVersionInfo\lib\net46\System.Diagnostics.FileVersionInfo.dll - True + False True @@ -301,7 +301,7 @@ ..\packages\System.Diagnostics.StackTrace\lib\net46\System.Diagnostics.StackTrace.dll - True + False True @@ -312,7 +312,7 @@ ..\packages\System.IO\lib\net462\System.IO.dll - True + False True @@ -323,7 +323,7 @@ ..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll - True + False True @@ -334,7 +334,7 @@ ..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll - True + False True @@ -345,7 +345,7 @@ ..\packages\System.Linq\lib\net463\System.Linq.dll - True + False True @@ -356,7 +356,7 @@ ..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll - True + False True @@ -367,7 +367,7 @@ ..\packages\System.Reflection\lib\net462\System.Reflection.dll - True + False True @@ -392,7 +392,7 @@ ..\packages\System.Runtime\lib\net462\System.Runtime.dll - True + False True @@ -414,7 +414,7 @@ ..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll - True + False True @@ -425,7 +425,7 @@ ..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll - True + False True @@ -445,7 +445,7 @@ ..\packages\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll - True + False True @@ -456,7 +456,7 @@ ..\packages\System.Security.Cryptography.Encoding\lib\net46\System.Security.Cryptography.Encoding.dll - True + False True @@ -467,7 +467,7 @@ ..\packages\System.Security.Cryptography.Primitives\lib\net46\System.Security.Cryptography.Primitives.dll - True + False True @@ -478,7 +478,7 @@ ..\packages\System.Security.Cryptography.X509Certificates\lib\net461\System.Security.Cryptography.X509Certificates.dll - True + False True @@ -511,7 +511,7 @@ ..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll - True + False True @@ -522,7 +522,7 @@ ..\packages\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll - True + False True @@ -533,7 +533,7 @@ ..\packages\System.Xml.XmlDocument\lib\net46\System.Xml.XmlDocument.dll - True + False True @@ -544,7 +544,7 @@ ..\packages\System.Xml.XPath\lib\net46\System.Xml.XPath.dll - True + False True @@ -555,7 +555,7 @@ ..\packages\System.Xml.XPath.XDocument\lib\net46\System.Xml.XPath.XDocument.dll - True + False True diff --git a/Microdot.sln b/Microdot.sln index e409e266..8d8d9405 100644 --- a/Microdot.sln +++ b/Microdot.sln @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{0F8FE3 paket.dependencies = paket.dependencies paket.lock = paket.lock .paket\restore.bat = .paket\restore.bat + .paket\set.copy.local.false.libs.linq = .paket\set.copy.local.false.libs.linq .paket\update.bat = .paket\update.bat EndProjectSection EndProject @@ -176,7 +177,7 @@ Global {10E10FDE-8A2C-4D5D-8FC1-15FACF844E80} = {79538186-DFAD-463C-B4D1-CD0917CF5954} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\lib\portable-net45+win+wp8 SolutionGuid = {8A847321-B6B0-4BA9-9AC3-0DB91FA99B90} + EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\lib\portable-net45+win+wp8 EndGlobalSection EndGlobal diff --git a/Sample/CalculatorService.Orleans/CalculatorService.Orleans.csproj b/Sample/CalculatorService.Orleans/CalculatorService.Orleans.csproj index 5ef238f0..3efa1597 100644 --- a/Sample/CalculatorService.Orleans/CalculatorService.Orleans.csproj +++ b/Sample/CalculatorService.Orleans/CalculatorService.Orleans.csproj @@ -160,7 +160,7 @@ ..\..\packages\System.AppContext\lib\net463\System.AppContext.dll - True + False True @@ -191,7 +191,7 @@ ..\..\packages\System.Console\lib\net46\System.Console.dll - True + False True @@ -202,7 +202,7 @@ ..\..\packages\System.Diagnostics.FileVersionInfo\lib\net46\System.Diagnostics.FileVersionInfo.dll - True + False True @@ -213,7 +213,7 @@ ..\..\packages\System.Diagnostics.StackTrace\lib\net46\System.Diagnostics.StackTrace.dll - True + False True @@ -224,7 +224,7 @@ ..\..\packages\System.IO\lib\net462\System.IO.dll - True + False True @@ -235,7 +235,7 @@ ..\..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll - True + False True @@ -246,7 +246,7 @@ ..\..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll - True + False True @@ -257,7 +257,7 @@ ..\..\packages\System.Linq\lib\net463\System.Linq.dll - True + False True @@ -268,7 +268,7 @@ ..\..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll - True + False True @@ -279,7 +279,7 @@ ..\..\packages\System.Reflection\lib\net462\System.Reflection.dll - True + False True @@ -304,7 +304,7 @@ ..\..\packages\System.Runtime\lib\net462\System.Runtime.dll - True + False True @@ -326,7 +326,7 @@ ..\..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll - True + False True @@ -337,7 +337,7 @@ ..\..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll - True + False True @@ -357,7 +357,7 @@ ..\..\packages\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll - True + False True @@ -368,7 +368,7 @@ ..\..\packages\System.Security.Cryptography.Encoding\lib\net46\System.Security.Cryptography.Encoding.dll - True + False True @@ -379,7 +379,7 @@ ..\..\packages\System.Security.Cryptography.Primitives\lib\net46\System.Security.Cryptography.Primitives.dll - True + False True @@ -390,7 +390,7 @@ ..\..\packages\System.Security.Cryptography.X509Certificates\lib\net461\System.Security.Cryptography.X509Certificates.dll - True + False True @@ -412,7 +412,7 @@ ..\..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll - True + False True @@ -426,7 +426,7 @@ ..\..\packages\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll - True + False True @@ -446,7 +446,7 @@ ..\..\packages\System.Xml.XmlDocument\lib\net46\System.Xml.XmlDocument.dll - True + False True @@ -457,7 +457,7 @@ ..\..\packages\System.Xml.XPath\lib\net46\System.Xml.XPath.dll - True + False True @@ -468,7 +468,7 @@ ..\..\packages\System.Xml.XPath.XDocument\lib\net46\System.Xml.XPath.XDocument.dll - True + False True diff --git a/SolutionVersion.cs b/SolutionVersion.cs index 5f312630..138a60f9 100644 --- a/SolutionVersion.cs +++ b/SolutionVersion.cs @@ -28,9 +28,9 @@ [assembly: AssemblyCopyright("© 2018 Gigya Inc.")] [assembly: AssemblyDescription("Microdot Framework")] -[assembly: AssemblyVersion("1.14.1.0")] -[assembly: AssemblyFileVersion("1.14.1.0")] -[assembly: AssemblyInformationalVersion("1.14.1.0")] +[assembly: AssemblyVersion("1.14.2.0")] +[assembly: AssemblyFileVersion("1.14.2.0")] +[assembly: AssemblyInformationalVersion("1.14.2.0")] // 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 diff --git a/paket.dependencies b/paket.dependencies index 586514dc..8ba3f6fa 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -42,7 +42,7 @@ nuget Castle.Core ~> 4.0 #Tests only dependencies nuget NUnit ~> 3.0 nuget RichardSzalay.MockHttp -nuget NSubstitute +nuget NSubstitute >= 3.1 nuget FluentAssertions nuget Nuget.CommandLine nuget Shouldly diff --git a/paket.lock b/paket.lock index a6c1d653..bb1540df 100644 --- a/paket.lock +++ b/paket.lock @@ -104,8 +104,8 @@ NUGET Microsoft.Bcl.Async (>= 1.0.168) Microsoft.Bcl.Build (>= 1.0.21) NLog (4.5.11) - NSubstitute (4.0) - Castle.Core (>= 4.3.1) + NSubstitute (3.1) + Castle.Core (>= 4.2) System.Threading.Tasks.Extensions (>= 4.3) Nuget.CommandLine (4.9.2) NUnit (3.11) diff --git a/tests/Gigya.Microdot.Hosting.UnitTests/Gigya.Microdot.Hosting.UnitTests.csproj b/tests/Gigya.Microdot.Hosting.UnitTests/Gigya.Microdot.Hosting.UnitTests.csproj index 99101626..5c124826 100644 --- a/tests/Gigya.Microdot.Hosting.UnitTests/Gigya.Microdot.Hosting.UnitTests.csproj +++ b/tests/Gigya.Microdot.Hosting.UnitTests/Gigya.Microdot.Hosting.UnitTests.csproj @@ -288,7 +288,7 @@ ..\..\packages\System.AppContext\lib\net463\System.AppContext.dll - True + False True @@ -310,7 +310,7 @@ ..\..\packages\System.Console\lib\net46\System.Console.dll - True + False True @@ -321,7 +321,7 @@ ..\..\packages\System.Diagnostics.FileVersionInfo\lib\net46\System.Diagnostics.FileVersionInfo.dll - True + False True @@ -332,7 +332,7 @@ ..\..\packages\System.Diagnostics.StackTrace\lib\net46\System.Diagnostics.StackTrace.dll - True + False True @@ -343,7 +343,7 @@ ..\..\packages\System.IO\lib\net462\System.IO.dll - True + False True @@ -354,7 +354,7 @@ ..\..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll - True + False True @@ -365,7 +365,7 @@ ..\..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll - True + False True @@ -376,7 +376,7 @@ ..\..\packages\System.Linq\lib\net463\System.Linq.dll - True + False True @@ -387,7 +387,7 @@ ..\..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll - True + False True @@ -398,7 +398,7 @@ ..\..\packages\System.Reflection\lib\net462\System.Reflection.dll - True + False True @@ -423,7 +423,7 @@ ..\..\packages\System.Runtime\lib\net462\System.Runtime.dll - True + False True @@ -445,7 +445,7 @@ ..\..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll - True + False True @@ -456,7 +456,7 @@ ..\..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll - True + False True @@ -476,7 +476,7 @@ ..\..\packages\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll - True + False True @@ -487,7 +487,7 @@ ..\..\packages\System.Security.Cryptography.Encoding\lib\net46\System.Security.Cryptography.Encoding.dll - True + False True @@ -498,7 +498,7 @@ ..\..\packages\System.Security.Cryptography.Primitives\lib\net46\System.Security.Cryptography.Primitives.dll - True + False True @@ -509,7 +509,7 @@ ..\..\packages\System.Security.Cryptography.X509Certificates\lib\net461\System.Security.Cryptography.X509Certificates.dll - True + False True @@ -553,7 +553,7 @@ ..\..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll - True + False True @@ -564,7 +564,7 @@ ..\..\packages\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll - True + False True @@ -575,7 +575,7 @@ ..\..\packages\System.Xml.XmlDocument\lib\net46\System.Xml.XmlDocument.dll - True + False True @@ -586,7 +586,7 @@ ..\..\packages\System.Xml.XPath\lib\net46\System.Xml.XPath.dll - True + False True @@ -597,7 +597,7 @@ ..\..\packages\System.Xml.XPath.XDocument\lib\net46\System.Xml.XPath.XDocument.dll - True + False True diff --git a/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Gigya.Microdot.Orleans.Hosting.UnitTests.csproj b/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Gigya.Microdot.Orleans.Hosting.UnitTests.csproj index 0b9339e1..9a19615c 100644 --- a/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Gigya.Microdot.Orleans.Hosting.UnitTests.csproj +++ b/tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Gigya.Microdot.Orleans.Hosting.UnitTests.csproj @@ -327,7 +327,7 @@ ..\..\packages\System.AppContext\lib\net463\System.AppContext.dll - True + False True @@ -349,7 +349,7 @@ ..\..\packages\System.Console\lib\net46\System.Console.dll - True + False True @@ -360,7 +360,7 @@ ..\..\packages\System.Diagnostics.FileVersionInfo\lib\net46\System.Diagnostics.FileVersionInfo.dll - True + False True @@ -371,7 +371,7 @@ ..\..\packages\System.Diagnostics.StackTrace\lib\net46\System.Diagnostics.StackTrace.dll - True + False True @@ -382,7 +382,7 @@ ..\..\packages\System.IO\lib\net462\System.IO.dll - True + False True @@ -393,7 +393,7 @@ ..\..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll - True + False True @@ -404,7 +404,7 @@ ..\..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll - True + False True @@ -415,7 +415,7 @@ ..\..\packages\System.Linq\lib\net463\System.Linq.dll - True + False True @@ -426,7 +426,7 @@ ..\..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll - True + False True @@ -437,7 +437,7 @@ ..\..\packages\System.Reflection\lib\net462\System.Reflection.dll - True + False True @@ -462,7 +462,7 @@ ..\..\packages\System.Runtime\lib\net462\System.Runtime.dll - True + False True @@ -484,7 +484,7 @@ ..\..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll - True + False True @@ -495,7 +495,7 @@ ..\..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll - True + False True @@ -515,7 +515,7 @@ ..\..\packages\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll - True + False True @@ -526,7 +526,7 @@ ..\..\packages\System.Security.Cryptography.Encoding\lib\net46\System.Security.Cryptography.Encoding.dll - True + False True @@ -537,7 +537,7 @@ ..\..\packages\System.Security.Cryptography.Primitives\lib\net46\System.Security.Cryptography.Primitives.dll - True + False True @@ -548,7 +548,7 @@ ..\..\packages\System.Security.Cryptography.X509Certificates\lib\net461\System.Security.Cryptography.X509Certificates.dll - True + False True @@ -592,7 +592,7 @@ ..\..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll - True + False True @@ -614,7 +614,7 @@ ..\..\packages\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll - True + False True @@ -625,7 +625,7 @@ ..\..\packages\System.Xml.XmlDocument\lib\net46\System.Xml.XmlDocument.dll - True + False True @@ -636,7 +636,7 @@ ..\..\packages\System.Xml.XPath\lib\net46\System.Xml.XPath.dll - True + False True @@ -647,7 +647,7 @@ ..\..\packages\System.Xml.XPath.XDocument\lib\net46\System.Xml.XPath.XDocument.dll - True + False True