From 9e244faec5529209be91d3c63a350ef3dbdd4c0a Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sat, 13 May 2017 10:38:03 +0900 Subject: [PATCH 1/4] add test solution and project data --- .../ExampleLibrary/ExampleLibrary.vcxproj | 139 +++++++++++++++ .../ExampleLibrary.vcxproj.filters | 9 + .../ExampleProject/ExampleLibrary/Library.cpp | 6 + .../ExampleProject/ExampleLibrary/Library.h | 3 + tests/data/ExampleProject/ExampleProject.sln | 41 +++++ .../ExampleProject/ExampleProject.vcxproj | 159 ++++++++++++++++++ .../ExampleProject.vcxproj.filters | 6 + .../ExampleProject/ExampleProject/main.cpp | 7 + .../data/ExampleProject/ExampleProjectBOM.sln | 41 +++++ .../ExampleProjectProcessed.sln | 41 +++++ .../ExampleProjectProcessedBOM.sln | 41 +++++ 11 files changed, 493 insertions(+) create mode 100644 tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj create mode 100644 tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj.filters create mode 100644 tests/data/ExampleProject/ExampleLibrary/Library.cpp create mode 100644 tests/data/ExampleProject/ExampleLibrary/Library.h create mode 100644 tests/data/ExampleProject/ExampleProject.sln create mode 100644 tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj create mode 100644 tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj.filters create mode 100644 tests/data/ExampleProject/ExampleProject/main.cpp create mode 100644 tests/data/ExampleProject/ExampleProjectBOM.sln create mode 100644 tests/data/ExampleProject/ExampleProjectProcessed.sln create mode 100644 tests/data/ExampleProject/ExampleProjectProcessedBOM.sln diff --git a/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj b/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj new file mode 100644 index 0000000..f978665 --- /dev/null +++ b/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + 15.0 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} + Win32Proj + ExampleLibrary + 10.0.15063.0 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + + + + + + \ No newline at end of file diff --git a/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj.filters b/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj.filters new file mode 100644 index 0000000..e6fdabe --- /dev/null +++ b/tests/data/ExampleProject/ExampleLibrary/ExampleLibrary.vcxproj.filters @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/tests/data/ExampleProject/ExampleLibrary/Library.cpp b/tests/data/ExampleProject/ExampleLibrary/Library.cpp new file mode 100644 index 0000000..132b581 --- /dev/null +++ b/tests/data/ExampleProject/ExampleLibrary/Library.cpp @@ -0,0 +1,6 @@ +#include "Library.h" + +int Add(int a, int b) +{ + return a + b; +} diff --git a/tests/data/ExampleProject/ExampleLibrary/Library.h b/tests/data/ExampleProject/ExampleLibrary/Library.h new file mode 100644 index 0000000..203e4f2 --- /dev/null +++ b/tests/data/ExampleProject/ExampleLibrary/Library.h @@ -0,0 +1,3 @@ +#pragma once + +int Add(int a, int b); diff --git a/tests/data/ExampleProject/ExampleProject.sln b/tests/data/ExampleProject/ExampleProject.sln new file mode 100644 index 0000000..8e0d74e --- /dev/null +++ b/tests/data/ExampleProject/ExampleProject.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleLibrary", "ExampleLibrary\ExampleLibrary.vcxproj", "{7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleProject", "ExampleProject\ExampleProject.vcxproj", "{A63A0959-2EED-46D4-8E0B-3FE4D545E156}" + ProjectSection(ProjectDependencies) = postProject + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} = {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.ActiveCfg = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.Build.0 = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.ActiveCfg = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.Build.0 = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.ActiveCfg = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.Build.0 = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.ActiveCfg = Release|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.Build.0 = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.ActiveCfg = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.Build.0 = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.ActiveCfg = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.Build.0 = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.ActiveCfg = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.Build.0 = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.ActiveCfg = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj b/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj new file mode 100644 index 0000000..6062f6b --- /dev/null +++ b/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156} + Win32Proj + ExampleProject + 10.0.15063.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../ExampleLibrary + + + Console + $(OutDir) + ExampleLibrary.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../ExampleLibrary + + + Console + $(OutDir) + ExampleLibrary.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../ExampleLibrary + + + Console + true + true + $(OutDir) + ExampleLibrary.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../ExampleLibrary + + + Console + true + true + $(OutDir) + ExampleLibrary.lib;%(AdditionalDependencies) + + + + + + + + + \ No newline at end of file diff --git a/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj.filters b/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj.filters new file mode 100644 index 0000000..4327830 --- /dev/null +++ b/tests/data/ExampleProject/ExampleProject/ExampleProject.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/data/ExampleProject/ExampleProject/main.cpp b/tests/data/ExampleProject/ExampleProject/main.cpp new file mode 100644 index 0000000..51e66a1 --- /dev/null +++ b/tests/data/ExampleProject/ExampleProject/main.cpp @@ -0,0 +1,7 @@ +#include +#include "Library.h" + +void main() +{ + printf("1 + 2 = %d\n", Add(1, 2)); +} diff --git a/tests/data/ExampleProject/ExampleProjectBOM.sln b/tests/data/ExampleProject/ExampleProjectBOM.sln new file mode 100644 index 0000000..c6d7b37 --- /dev/null +++ b/tests/data/ExampleProject/ExampleProjectBOM.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleLibrary", "ExampleLibrary\ExampleLibrary.vcxproj", "{7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleProject", "ExampleProject\ExampleProject.vcxproj", "{A63A0959-2EED-46D4-8E0B-3FE4D545E156}" + ProjectSection(ProjectDependencies) = postProject + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} = {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.ActiveCfg = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.Build.0 = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.ActiveCfg = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.Build.0 = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.ActiveCfg = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.Build.0 = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.ActiveCfg = Release|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.Build.0 = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.ActiveCfg = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.Build.0 = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.ActiveCfg = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.Build.0 = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.ActiveCfg = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.Build.0 = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.ActiveCfg = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/data/ExampleProject/ExampleProjectProcessed.sln b/tests/data/ExampleProject/ExampleProjectProcessed.sln new file mode 100644 index 0000000..70132cc --- /dev/null +++ b/tests/data/ExampleProject/ExampleProjectProcessed.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleProject", "ExampleProject\ExampleProject.vcxproj", "{A63A0959-2EED-46D4-8E0B-3FE4D545E156}" + ProjectSection(ProjectDependencies) = postProject + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} = {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleLibrary", "ExampleLibrary\ExampleLibrary.vcxproj", "{7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.ActiveCfg = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.Build.0 = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.ActiveCfg = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.Build.0 = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.ActiveCfg = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.Build.0 = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.ActiveCfg = Release|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.Build.0 = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.ActiveCfg = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.Build.0 = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.ActiveCfg = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.Build.0 = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.ActiveCfg = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.Build.0 = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.ActiveCfg = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/data/ExampleProject/ExampleProjectProcessedBOM.sln b/tests/data/ExampleProject/ExampleProjectProcessedBOM.sln new file mode 100644 index 0000000..04d2686 --- /dev/null +++ b/tests/data/ExampleProject/ExampleProjectProcessedBOM.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleProject", "ExampleProject\ExampleProject.vcxproj", "{A63A0959-2EED-46D4-8E0B-3FE4D545E156}" + ProjectSection(ProjectDependencies) = postProject + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} = {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleLibrary", "ExampleLibrary\ExampleLibrary.vcxproj", "{7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.ActiveCfg = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x64.Build.0 = Debug|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.ActiveCfg = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Debug|x86.Build.0 = Debug|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.ActiveCfg = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x64.Build.0 = Release|x64 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.ActiveCfg = Release|Win32 + {A63A0959-2EED-46D4-8E0B-3FE4D545E156}.Release|x86.Build.0 = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.ActiveCfg = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x64.Build.0 = Debug|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.ActiveCfg = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Debug|x86.Build.0 = Debug|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.ActiveCfg = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x64.Build.0 = Release|x64 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.ActiveCfg = Release|Win32 + {7C961FE3-7761-4E1D-B533-4FD5F6D1AC82}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From 7b1718eb2b35b884f2373fa4468875a6d1390ba5 Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sat, 13 May 2017 10:57:09 +0900 Subject: [PATCH 2/4] add a unit test for the bug that a solution file corrupt when it has dependencies. --- projects/slnStartupProject.sln | 15 ++- .../slnStartupProjectUnitTest/packages.config | 5 + .../slnStartupProjectUnitTest.csproj | 84 +++++++++++++++ .../Properties/AssemblyInfo.cs | 16 +++ src/slnStartupProjectUnitTest/UnitTest.cs | 101 ++++++++++++++++++ 5 files changed, 216 insertions(+), 5 deletions(-) create mode 100644 projects/vs2013/slnStartupProjectUnitTest/packages.config create mode 100644 projects/vs2013/slnStartupProjectUnitTest/slnStartupProjectUnitTest.csproj create mode 100644 src/slnStartupProjectUnitTest/Properties/AssemblyInfo.cs create mode 100644 src/slnStartupProjectUnitTest/UnitTest.cs diff --git a/projects/slnStartupProject.sln b/projects/slnStartupProject.sln index ea1a212..7119b01 100644 --- a/projects/slnStartupProject.sln +++ b/projects/slnStartupProject.sln @@ -7,21 +7,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "slnStartupProject", "vs2013 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "slnStartupProjectLibrary", "vs2013\slnStartupProjectLibrary\slnStartupProjectLibrary.csproj", "{A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}" EndProject - +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "slnStartupProjectUnitTest", "vs2013\slnStartupProjectUnitTest\slnStartupProjectUnitTest.csproj", "{BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Release|Any CPU.Build.0 = Release|Any CPU {4DB074A8-D175-41C7-BAAF-00F2F73C970E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4DB074A8-D175-41C7-BAAF-00F2F73C970E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4DB074A8-D175-41C7-BAAF-00F2F73C970E}.Release|Any CPU.ActiveCfg = Release|Any CPU {4DB074A8-D175-41C7-BAAF-00F2F73C970E}.Release|Any CPU.Build.0 = Release|Any CPU + {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A01E2F2D-CCD1-46B4-82D7-EB4C7A503004}.Release|Any CPU.Build.0 = Release|Any CPU + {BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/projects/vs2013/slnStartupProjectUnitTest/packages.config b/projects/vs2013/slnStartupProjectUnitTest/packages.config new file mode 100644 index 0000000..5220dcd --- /dev/null +++ b/projects/vs2013/slnStartupProjectUnitTest/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/projects/vs2013/slnStartupProjectUnitTest/slnStartupProjectUnitTest.csproj b/projects/vs2013/slnStartupProjectUnitTest/slnStartupProjectUnitTest.csproj new file mode 100644 index 0000000..4baf631 --- /dev/null +++ b/projects/vs2013/slnStartupProjectUnitTest/slnStartupProjectUnitTest.csproj @@ -0,0 +1,84 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {BBE2A7B3-5A0F-4326-AD58-BD6D3F7B956C} + Library + Properties + slnStartupProjectUnitTest + slnStartupProjectUnitTest + v3.5 + 512 + + + + + 3.5 + + + true + full + false + ..\..\..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\NUnit.3.6.1\lib\net35\nunit.framework.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + AssemblyInfo.cs + + + UnitTest.cs + + + + + + {a01e2f2d-ccd1-46b4-82d7-eb4c7a503004} + slnStartupProjectLibrary + + + + + + + + + + + \ No newline at end of file diff --git a/src/slnStartupProjectUnitTest/Properties/AssemblyInfo.cs b/src/slnStartupProjectUnitTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..28a907c --- /dev/null +++ b/src/slnStartupProjectUnitTest/Properties/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("slnStartupProjectUnitTest")] +[assembly: AssemblyDescription("A .NET library to set the default StartUp project of a Visual Studio solution file")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("iVoltage")] +[assembly: AssemblyProduct("sln StartUp Project UnitTest")] +[assembly: AssemblyCopyright("Copyright © Michel Courtine 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("bbe2a7b3-5a0f-4326-ad58-bd6d3f7b956c")] +[assembly: AssemblyVersion("1.1.1.0")] +[assembly: AssemblyFileVersion("1.1.1.0")] diff --git a/src/slnStartupProjectUnitTest/UnitTest.cs b/src/slnStartupProjectUnitTest/UnitTest.cs new file mode 100644 index 0000000..194e556 --- /dev/null +++ b/src/slnStartupProjectUnitTest/UnitTest.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Reflection; +using NUnit.Framework; +using slnStartupProjectLibrary; + +namespace slnStartupUnitTest +{ + [TestFixture] + public class UnitTest + { + readonly Assembly assemby = Assembly.GetAssembly(typeof(UnitTest)); + private string testSolutionDirectory; + + /// + /// SetUp + /// + [SetUp] + public void SetUp() + { + testSolutionDirectory = GetTestSolutionDirectory(); + } + + /// + /// TearDown + /// + [TearDown] + public void TearDown() + { + } + + /// + /// Run Test when the solution has dependencies and doesn't have BOM. + /// + [Test] + public void Run() + { + var baseSolution = Path.Combine(testSolutionDirectory, "ExampleProject.sln"); + var processedSolution = Path.Combine(testSolutionDirectory, "ExampleProjectProcessed.sln"); + var tempSolution = Path.Combine(testSolutionDirectory, "ExampleProjectTemp.sln"); + + if (File.Exists(tempSolution)) + { + File.Delete(tempSolution); + } + File.Copy(baseSolution, tempSolution); + Parser.SetStartupProject(tempSolution, "ExampleProject"); + + FileAssert.AreEqual(processedSolution, tempSolution); + + File.Delete(tempSolution); + } + + + /// + /// Run Test when the solution has dependencies and has BOM. + /// + [Test] + public void RunWithBOM() + { + var baseSolution = Path.Combine(testSolutionDirectory, "ExampleProjectBOM.sln"); + var processedSolution = Path.Combine(testSolutionDirectory, "ExampleProjectProcessedBOM.sln"); + var tempSolution = Path.Combine(testSolutionDirectory, "ExampleProjectTemp.sln"); + + if (File.Exists(tempSolution)) + { + File.Delete(tempSolution); + } + File.Copy(baseSolution, tempSolution); + Parser.SetStartupProject(tempSolution, "ExampleProject"); + + FileAssert.AreEqual(processedSolution, tempSolution); + + File.Delete(tempSolution); + } + + /// + /// Get the Directory of the Assemby + /// + /// + private string GetAssembyDirectory() + { + var assembyPath = this.assemby.Location; + var assembyDirecctory = Path.GetDirectoryName(assembyPath); + return assembyDirecctory; + } + + /// + /// Get the Directory of test solution + /// + /// + private string GetTestSolutionDirectory() + { + var testSolutionDirecotry = Path.GetFullPath(Path.Combine(GetAssembyDirectory(), @"..\..\tests\data\ExampleProject")); + return testSolutionDirecotry; + } + } +} From 718bf4a15e896c64cf882d4a0f4b232e78f52b8a Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sat, 13 May 2017 17:20:55 +0900 Subject: [PATCH 3/4] ignore temporal directory --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 09c2acd..a7e0d92 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ projects/packages/* projects/vs2008/slnStartupProject/obj/ projects/vs2008/slnStartupProjectLibrary/obj/ projects/vs2013/slnStartupProject/obj/ -projects/vs2013/slnStartupProjectLibrary/obj/ \ No newline at end of file +projects/vs2013/slnStartupProjectLibrary/obj/ +/tests/data/ExampleProject/.vs From 3d9710f639499e582f8516f2f3360727413cfccb Mon Sep 17 00:00:00 2001 From: Masaru Tsuchiyama Date: Sat, 13 May 2017 17:34:18 +0900 Subject: [PATCH 4/4] add *.db to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a7e0d92..fd62f16 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ projects/vs2008/slnStartupProjectLibrary/obj/ projects/vs2013/slnStartupProject/obj/ projects/vs2013/slnStartupProjectLibrary/obj/ /tests/data/ExampleProject/.vs +*.db