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

Add version types to AssemblyVersion layout renderer #2480

Closed
alexangas opened this issue Dec 29, 2017 · 8 comments
Closed

Add version types to AssemblyVersion layout renderer #2480

alexangas opened this issue Dec 29, 2017 · 8 comments
Labels
Milestone

Comments

@alexangas
Copy link
Contributor

Type: Feature request

NLog version: 4.5.0

Platform: .Net 3.5 / .Net 4.0 / .Net 4.5 / Mono 4 / Silverlight 4 / Silverlight 5 / Xamarin Android / Xamarin iOs / .NET Core

Current NLog config: N/A

I would like to extend the AssemblyVersion layout renderer to be able to specify different version types, e.g. from here:

  • AssemblyVersion
  • FileVersion
  • InformationalVersion

So the current renderer syntax of ${assembly-version:name=string} could become ${assembly-version:name=string:type=string} where the value for type is one of:

  • assembly
  • file
  • informational

I'm happy to provide this in a pull request with unit tests, etc... if agreed 😃

@304NotModified
Copy link
Member

Sounds good to me!

Please make sure it's backwards-compatible and that the enum is in-line with the other enums (naming etc)

Thx in advance!

@alexangas
Copy link
Contributor Author

I've started working on this and can see the need to test against different frameworks due to conditional compilation. How do I switch to run unit tests in, say, Silverlight vs .NET Core 2.0 vs .NET Framework 4.5?

Also, I need one or more "test assemblies" with different version numbers set for each version type so I can correctly write unit tests for this. At the moment the NLogAutoLoadExtension is being used which possibly could be better? How should I do this - create binaries for different frameworks for use by unit tests?

Thanks for your help!

@304NotModified
Copy link
Member

Hi!

The tests will be run for all the platforms automatically.

Maybe it's better to make the layout renderer mockable (internal property, guess type Assembly) and create a mock?

@alexangas
Copy link
Contributor Author

I could create a mock, but how will I know it's actually working correctly for each platform? Perhaps I will make a little test project/repo in my GitHub account and report back here?

@304NotModified
Copy link
Member

304NotModified commented Jan 2, 2018

I could create a mock, but how will I know it's actually working correctly for each platform?

The unit test is run for the platforms? Or are you afraid for Xamarin etc?

@alexangas
Copy link
Contributor Author

alexangas commented Jan 2, 2018

Yes I'm thinking of Xamarin, Mono, UWP, etc... Working on this feature highlighted to me how fractured the ecosystem is despite the introduction of .NET Standard! So I would like to have some more confidence in those other platforms. Unless it is better to assume it will all work and tackle exceptions on a case-by-case basis. Any problems are more likely to be found on older platforms and it's possible they may never use this feature?

What I have been able to do is adapt code from other unit tests to build an in-memory assembly for testing using Roslyn. That works great 😃

@snakefoot
Copy link
Contributor

snakefoot commented Jan 2, 2018

@alexangas If you can make it work with NetFramework and NetStandard on Windows, then you are very close to done. If you can also make it work on Mono and NetStandard on Linux, then you are home safe. Other platforms only rely on it being able to compile on the build-server.

Usually the test-project "NLogAutoLoadExtension" or "SampleExtensions" are used for doing external assembly testing.

@304NotModified
Copy link
Member

merged 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants