-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DocumentFormat.OpenXml.Linq project #1000
Conversation
/azp run |
Thanks for separating this out! I'm fine not having it a source generator for now (we can play around with that after getting the main structure in. As for what to target, best to target the same as the samples for now probably |
What exactly do you mean by "samples"? I would see the following options:
|
@twsouthwick, could you tell me why the build failed? And do you have any further feedback? |
e31a625
to
c73f3d1
Compare
@twsouthwick, it seems I had not pulled the most recent commits from upstream when creating the branch from main. Therefore, the reason for the failed check was a failed unit test that was unrelated to this PR. I pulled from upstream and rebased my PR branch. At least on my local machine, all unit tests now pass. So please run the check again. |
/azp run |
@twsouthwick, why did this check fail? |
Just to be sure, I checked again, running the following on my local machine for both the Debug and Release configurations:
For both Debug and Release, it builds without any warnings or errors and all unit tests pass. Is there any other check performed on the build server beyond what we can check on our machines? Would it be possible to get access to the build server outputs at least? Not knowing why stuff fails is a bit unsatisfying. |
@twsouthwick, do you have any feedback on my questions above? Firstly:
Secondly, why did the check fail?
|
src/DocumentFormat.OpenXml.Linq/DocumentFormat.OpenXml.Linq.csproj
Outdated
Show resolved
Hide resolved
Sorry for the slow responses - between some busy projects and vacations, I've had little time to review here. This is shaping up fine and once we get the 2.13.1 release out (hopefully today), we can then get these merged in. Let's not worry about the code generation at this point and leave what you have in. After that, I have some ideas as to how to make the code generators work, but what you're doing now is fine. |
Thanks, Taylor. I've added a commit that changes the .csproj file so that we are targeting the |
/azp run |
This commit adds the DocumentFormat.OpenXml.Linq project with code generated by the DocumentFormat.OpenXml.CodeGeneration.Linq project. It enables the code generation by also enhancing the ElementMetadata class.
This commit changes the code generation project to target whatever the samples target. At the moment, this is net46, netcoreapp2.1, netcoreapp3.1, and net5.0. Further, the Main method now takes one optional argument for the target directory into which the generated classes are written. If no argument is provided, a default is used.
d993f9f
to
8e9aacc
Compare
@twsouthwick, please run the checks to see whether it works. It builds successfully on my machine with I've noted that the unit tests target |
I'll try to answer all the questions:
|
/azp run |
I pushed a change that should work - it will only compile for .NET 5.0, but on the other sample projects, it will just output a message saying it is unsupported on that target. Long term we can hopefully streamline this, but the build matrix on the server is done so that we can run tests against the .NET 3.5 builds. |
/azp run |
As discussed in #952 (Provide direct support for Linq to XML), this PR adds the
DocumentFormat.OpenXml.Linq
project with code generated by theDocumentFormat.OpenXml.CodeGeneration.Linq
project. It enables code generation by also enhancing theElementMetadata
class.I made an effort to implement the
DocumentFormat.OpenXml.CodeGeneration.Linq
project as a C# Source Generator. However, it turned out to be either impossible or at least too complex (and therefore not worth the effort). A C# Sourcing Generator must targetnetstandard2.0
and cannot depend on other projects in the same solution unless those are also analyzers. In particular, a dependency on theDocumentFormat.OpenXml
project is not possible. However, that is required to generate the namespace-related classes for Linq to XML.We'll have to discuss the following questions:
DocumentFormat.OpenXml.CodeGeneration.Linq
into the build process? It is a console project that currently targetsnet5.0
and can be invoked easily.DocumentFormat.OpenXml.Linq
target? In this initial commit, it only targetsnetstandard2.0
. Should we addnet461
like other Microsoft NuGet packages targetingnetstandard2.0
(which do not support any .NET framework older than 4.6.1)? Or do we have to support all the legacy frameworks that are also targeted byDocumentFormat.OpenXml
?