diff --git a/src/Main/Base/Project/Src/Project/Solution/Solution.cs b/src/Main/Base/Project/Src/Project/Solution/Solution.cs index 05926d5218..3635290c7b 100644 --- a/src/Main/Base/Project/Src/Project/Solution/Solution.cs +++ b/src/Main/Base/Project/Src/Project/Solution/Solution.cs @@ -1193,9 +1193,9 @@ namespace ICSharpCode.SharpDevelop.Project return newSolution; } - void UpdateMSBuildProperties() + public void UpdateMSBuildProperties() { - MSBuildProjectCollection.SetGlobalProperty("SolutionDir", Directory); + MSBuildProjectCollection.SetGlobalProperty("SolutionDir", Directory + @"\"); } #endregion diff --git a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj index c8b842d0eb..d57c014a27 100644 --- a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj +++ b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj @@ -33,6 +33,7 @@ 4096 + 3.0 @@ -108,6 +109,7 @@ + diff --git a/src/Main/Base/Test/SolutionTests.cs b/src/Main/Base/Test/SolutionTests.cs new file mode 100644 index 0000000000..5a8e07b6a0 --- /dev/null +++ b/src/Main/Base/Test/SolutionTests.cs @@ -0,0 +1,38 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +using System; +using ICSharpCode.SharpDevelop.Project; +using Microsoft.Build.Execution; +using NUnit.Framework; +using Rhino.Mocks; + +namespace ICSharpCode.SharpDevelop.Tests +{ + [TestFixture] + public class SolutionTests + { + Solution solution; + + void CreateSolution() + { + IProjectChangeWatcher fakeWatcher = MockRepository.GenerateStub(); + solution = new Solution(fakeWatcher); + } + + [Test] + public void UpdateMSBuildProperties_SolutionHasFileName_SolutionDefinesSolutionDirMSBuildPropertyWithDirectoryEndingInForwardSlash() + { + CreateSolution(); + solution.FileName = @"d:\projects\MyProject\MySolution.sln"; + + solution.UpdateMSBuildProperties(); + + ProjectPropertyInstance property = solution.MSBuildProjectCollection.GetGlobalProperty("SolutionDir"); + string solutionDir = property.EvaluatedValue; + + string expectedSolutionDir = @"d:\projects\MyProject\"; + Assert.AreEqual(expectedSolutionDir, solutionDir); + } + } +}