Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions KeePassPluginDevTools.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{4B5B8E16-3542-4997-8BF3-2DFFF5E9F1C2}"
EndProject
Expand Down Expand Up @@ -144,6 +144,9 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {34BC3374-C348-42FC-AB5F-C9C7422942DA}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = PlgxTools\PlgxTools.csproj
Policies = $0
Expand Down
7 changes: 5 additions & 2 deletions PlgxTools/Microsoft.Build.Plgx.xsd
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003"
targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003"
elementFormDefault="qualified">
<xs:include schemaLocation="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Xml\Schemas\1033\Microsoft.Build.xsd" />

<!-- <xs:include schemaLocation="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Xml\Schemas\1033\Microsoft.Build.xsd" /> -->

<!-- Support for Visual Studio 2017 Community -->
<xs:include schemaLocation="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Xml\Schemas\1033\Microsoft.Build.xsd" />
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a variable we could use here instead of requiring a specific version of Visual Studio installed in the default location.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point, I did a bit of research beforehand, but I couldn't find anything like that. It is possible to have multiple include elements in it though. For example, line 6 could stay there uncommented but it then it will result in warning messages at compile time as it is not going to be able to find Microsoft Visual Studio 14.0 path if Visual Studio 2015 isn't installed. However, it will compile correctly as long as one of the includes path exists. Another idea: maybe it is possible to create a conditional XSD schema structure to pick the right path based on the Visual Studio version. The problem with it is that the VS version needs to be read from the XSD file somehow.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need this for cross-platform compatibility!


<!-- Extend Microsoft.Build.xsd to include properties used by PlgxTool.targets -->
<!-- Also see: http://keepass.info/help/v2_dev/plg_index.html#plgx -->

Expand Down
10 changes: 4 additions & 6 deletions PlgxTools/PlgxTool.csproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,16 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="GetXsdExe">
<!-- based on http://connect.microsoft.com/VisualStudio/feedback/details/583931/xsd-exe-should-be-accessible-from-ide-builds -->
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="SdkPath" />
</GetFrameworkSdkPath>
<CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value="$(SdkPath)bin\NETFX 4.0 Tools\xsd.exe">
<Error Condition="'$(SDK40ToolsPath)'==''" Text="Missing SDK40ToolsPath property." />
<Error Condition="!Exists('$(SDK40ToolsPath)xsd.exe')" Text="xsd.exe cannot be found at SDK40ToolsPath: $(SDK40ToolsPath)xsd.exe." />
<CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value="&quot;$(SDK40ToolsPath)xsd.exe&quot;">
<Output TaskParameter="Value" PropertyName="XsdExe" />
</CreateProperty>
<CreateProperty Condition="'$(OS)' != 'Windows_NT'" Value="xsd">
<Output TaskParameter="Value" PropertyName="XsdExe" />
</CreateProperty>
</Target>
<Target Name="BeforeBuild">
<CallTarget Targets="GetXsdExe" />
<Target Name="BeforeBuild" DependsOnTargets="GetXsdExe">
<Exec Command="$(XsdExe) Microsoft.Build.Plgx.xsd /c /n:$(RootNamespace)" />
</Target>
<Target Name="AfterClean">
Expand Down
9 changes: 4 additions & 5 deletions PlgxTools/Program.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using KeePassLib;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;

namespace KeePassPluginDevTools.PlgxTools
{
Expand Down Expand Up @@ -214,12 +215,10 @@ public static int Main (string[] args)
// include all of the project files unless specifically excluded
var itemGroups = project.GetElementsByTagName ("ItemGroup");
foreach (XmlNode itemGroup in itemGroups) {
// make copy of nodes so that we can delete them inside of the for
// make copy of nodes except comments so that we can delete them inside of the for
// loop if we need to
var children = new List<XmlNode> ();
foreach (XmlNode child in itemGroup.ChildNodes) {
children.Add (child);
}
var children = itemGroup.ChildNodes.Cast<XmlNode>().Where(child => child.NodeType != XmlNodeType.Comment).ToList();

foreach (XmlNode child in children) {
if (child.LocalName == "Reference") {
foreach (XmlNode childMetadata in child.ChildNodes) {
Expand Down