Browse Source

Fixed potential cause for NullReferenceException in CppProject.get_OutputAssemblyFullPath.

pull/18/head
Daniel Grunwald 14 years ago
parent
commit
9f36c5a5e4
  1. 2
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/CppProject.cs
  2. 14
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  3. 23
      src/Main/Base/Project/Src/Project/Solution/Solution.cs

2
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/CppProject.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.CppBinding.Project @@ -71,7 +71,7 @@ namespace ICSharpCode.CppBinding.Project
{
// in #D every project is compiled by msbuild separately, this mean that SolutionDir will
// be equal to ProjectDir, so it has to be replaced with actual solution directory
string evaluatedSolutionDir = GetEvaluatedProperty("SolutionDir");
string evaluatedSolutionDir = GetEvaluatedProperty("SolutionDir") ?? "";
outputPath = Path.Combine(ParentSolution.Directory, outputPath.Substring(evaluatedSolutionDir.Length));
}
return FileUtility.NormalizePath(Path.Combine(outputPath, AssemblyName + GetExtension(OutputType)));

14
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -1109,22 +1109,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1109,22 +1109,10 @@ namespace ICSharpCode.SharpDevelop.Project
// which is necessary to resolve the referenced project's OutputPath.
projectOptions.Properties["CurrentSolutionConfigurationContents"] = solutionConfigurationXml.ToString();
projectOptions.Properties["SolutionDir"] = EnsureBackslash(solution.Directory);
projectOptions.Properties["SolutionExt"] = ".sln";
projectOptions.Properties["SolutionFileName"] = Path.GetFileName(solution.FileName);
projectOptions.Properties["SolutionName"] = solution.Name;
projectOptions.Properties["SolutionPath"] = solution.FileName;
solution.AddMSBuildSolutionProperties(projectOptions.Properties);
return projectOptions;
}
static string EnsureBackslash(string path)
{
if (path.EndsWith("\\", StringComparison.Ordinal))
return path;
else
return path + "\\";
}
#endregion
#region Loading

23
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -1199,7 +1199,28 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1199,7 +1199,28 @@ namespace ICSharpCode.SharpDevelop.Project
public void UpdateMSBuildProperties()
{
MSBuildProjectCollection.SetGlobalProperty("SolutionDir", Directory + @"\");
var dict = new Dictionary<string, string>();
AddMSBuildSolutionProperties(dict);
foreach (var pair in dict) {
MSBuildProjectCollection.SetGlobalProperty(pair.Key, pair.Value);
}
}
public void AddMSBuildSolutionProperties(IDictionary<string, string> propertyDict)
{
propertyDict["SolutionDir"] = EnsureBackslash(this.Directory);
propertyDict["SolutionExt"] = ".sln";
propertyDict["SolutionFileName"] = Path.GetFileName(this.FileName);
propertyDict["SolutionName"] = this.Name;
propertyDict["SolutionPath"] = this.FileName;
}
static string EnsureBackslash(string path)
{
if (path.EndsWith("\\", StringComparison.Ordinal))
return path;
else
return path + "\\";
}
#endregion

Loading…
Cancel
Save