Skip to content

Conversation

@Rixxo
Copy link

@Rixxo Rixxo commented Jan 13, 2019

PlgxTools.exe fails when there are XML comments <!-- --> into <ItemGroup> sections in the plugin .csproj file. I have applied a little fix to the build process to skip comments.

The original solution was not compiling in Visual Studio 2017 due to incapability to locate xsd.exe. Moreover, the initial .csproj setup seemed to have issues passing property group value across targes. Not sure whether it was due to changes with Visual Studio 2017. Anyhow, I have fixed all those little issues.

Please let me know whether the changes look good to you and whether you a new NuGet package with the updates should be released.

Copy link
Owner

@dlech dlech left a comment

Choose a reason for hiding this comment

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

Thanks! I haven't tried using these changes yet, but I think they look OK if they work. I also wonder if there is a more modern way of extending msbuild in nuget packages that might be better.

for example:

<!-- <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
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
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.

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!

foreach (XmlNode child in children) {
var children = itemGroup.ChildNodes.Cast<XmlNode>().Where(child => child.NodeType != XmlNodeType.Comment).ToList();

foreach (XmlNode child in children) {
Copy link
Owner

Choose a reason for hiding this comment

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

Indent looks wrong on this line.

Copy link
Author

Choose a reason for hiding this comment

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

Good catch! Fixed it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants