Skip to content
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

.NET Core and VS2019 Compatibility #7

Closed
wants to merge 24 commits into from

Conversation

mnadareski
Copy link

@mnadareski mnadareski commented Feb 19, 2020

This PR does a number of things in order to bring forward compatibility to libmspack4n:

  • libmspack includes have been updated to conform to the new standard, namely that local includes should not use include <lib> and instead use include "lib". This is mostly cosmetic, but it also allows modern compilers to deal with the code
  • Along with the above, the libmspack project has been added to the solution, which allows it to be built in tandem with the other C# projects. This has the added benefit of allowing for enforcing dependencies in the C# projects
  • Updated csproj files to conform to the new standard that allows for .NET Core and .NET Standard projects. Some boilerplate such as file alignment was left out intentionally since it's not necessary for the new format
  • Added targets for .NET 4.6.1, .NET 4.6.2, .NET 4.7.2, .NET Core 2.1, and .NET Core 3.0. Removed .NET 4.0 target due to forward compatibility issues.
  • Added guards for LessIO so that the .NET Core 2.1 and 3.0 builds do not attempt to use LessIO until that is updated (I may take a stab at that myself if this PR goes over well)
  • Fixed some minor testing issues due to the csproj changes. I was not able to figure out why the second one failed (as per the existing Skip text), but I gave it my best and attempted to update the passing test to be more inline with XUnit expectations, including adding basic Assert statements. It's not perfect and I honestly don't know enough about the code to make any additional tests, but it's something.

This is a large change due to the sheer number of files and I can attempt to reduce the footprint if that is requested. A good number of these changes, especially in libmspack, were required by VS2019 when adding the vcxproj.

This fixes #6

@mnadareski
Copy link
Author

Just noticed that AppVeyor is failing on this. I think it's out of the compatibility with the new csproj format. This new format (and support for .NET Core) was introduced in either VS2017 or VS2019, I forget which at this point.

@mnadareski
Copy link
Author

Also of note, I can add as many .NET 4.5 and above targets as requested as a part of this, especially for the broadest direct compatibility

@mnadareski
Copy link
Author

Okay, I apologize for the incredibly large amount of commits that went into the AppVeyor cleanup. I had to go through multiple layers of indirection in order to figure out what the current best way of approaching most of the things. This did remove a lot of now-superfluous files and made everything much more automated. I don't blame you if you want to just try to cherry-pick some of the changes I made to fit your current flow. If this ends up being accepted, I'd strongly suggest Squash and Merge, just due to the sheer amount of "bad" commits above.

@activescott
Copy link
Owner

Sorry for the delay and thanks for the PR! I had a busy weekend and tonight discovered my windows box is foobared right now but I’ll get it up and running and give this a close look before merging. Based on what you describe and the fact that the tests appear to be passing I don’t expect any issues. Thanks again!

Copy link
Owner

@activescott activescott left a comment

Choose a reason for hiding this comment

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

Please put back the .bat files. I'm not interested in loading Visual Studio for any project, especially C++ projects. So I'd like to make sure we can always immediately jump in and build/compile it with a bat file and test it with a .bat file.

Why delete AssemblyInfo.cs? How is the assembly attributes set without it (again in a .bat/CI build)?

Please also pugt back the nuspec and nuget publishing. That stuff appears to be broken.


#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- cmd: 'msbuild .\.build\libmspack4n.msbuild /p:TheVersion="%APPVEYOR_BUILD_VERSION%" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"'
Copy link
Owner

Choose a reason for hiding this comment

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

So how are you setting the build version? Maybe I'm missing where you added it back, but definitely we cannot just not set the version during a build.

#---------------------------------#
# tests configuration #
#---------------------------------#
test:
Copy link
Owner

Choose a reason for hiding this comment

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

Have to have tests in place. Removing those is definitely not an option.

@@ -35,8 +41,13 @@ public sealed class MSCabinet : IDisposable

public MSCabinet(string cabinetFilename)
{
cabinetFilename = new Path(cabinetFilename).WithWin32LongPathPrefix();
Copy link
Owner

Choose a reason for hiding this comment

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

Did LessIO not build under .net core?

Copy link
Owner

Choose a reason for hiding this comment

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

As I mentioned somewhere, else if you have reliable alternatives in .NET CORE for long file names and anything else LessIO is being used for I'm fine with removing the dependency on LessIO. I just want to make sure that LessMSI's tests that work with long file names and CABs continue to work.

//TODO: Delete the file if it exists. If there are any issues ovewriting the dest file (e.g. it's readonly) MSPACK gives essentialy no error information.

#if NET_CORE
string longDestinationFilename = $"\\\\?\\{destinationFilename}";
Copy link
Owner

Choose a reason for hiding this comment

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

If you're confident that this will work for those long file names and the tests pass for this and in LessMSI's usage of this library I'm fine with removing LessIO entirely from this particular assembly.

Copy link
Owner

Choose a reason for hiding this comment

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

In fact, I'd prefer to remove it entirely rather than having #IF... Again assuming it works with long file names in all scenarios (some of which are tested in the LessMSI library)

Comment on lines +59 to +66
Assert.False(errors);

Assert.True(Directory.Exists(outDir));

var outputFiles = Directory.GetFiles(outDir, "*", SearchOption.AllDirectories);
Assert.Equal(fileCount, outputFiles.Count());

Directory.Delete(outDir, true);
Copy link
Owner

Choose a reason for hiding this comment

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

Super minor, but I'd prefer to eliminate the additional spacing in these lines.

using System.IO;
using System.Reflection;
using System.Linq;
Copy link
Owner

Choose a reason for hiding this comment

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

I know this is just tests, but don't see where we are we taking a dependency on Linq?

@mnadareski
Copy link
Author

I will be getting to the requested changes when I can. I ran into some hardware issues which means having to re-setup my development environment. I will try to do so in a reasonable timeframe.

@activescott
Copy link
Owner

Totally understand. I appreciate you taking the time. I feel bad about requesting so many changes, but I just feel like some of these things are critical to making it so I can keep this project maintainable. Thanks for understanding!

@activescott
Copy link
Owner

I'm going to close this since it is stale. If you want to re-open please do so or ping me and we'll get it going again.

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.

.NET Core Compatibility
2 participants