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

Port to .net core #8

Open
ruskindantra opened this issue Jul 1, 2017 · 5 comments
Open

Port to .net core #8

ruskindantra opened this issue Jul 1, 2017 · 5 comments

Comments

@ruskindantra
Copy link

Hi, I have ported this solution to .net core. Please visit my fork, if you are happy with it's structure then I can create a PR and you can publish this to your Nuget feed?

https://github.com/ruskindantra/semantictypes/releases/tag/v0.0.1-dotnetcore

Regards,
Ruskin

@mperdeck
Copy link
Owner

mperdeck commented Jul 7, 2017

Hi Ruskin,

Thanks for your interest in this project!

I would be interested in a ,.net core version of this. However, I would want the .net 4.x and .net core versions to share the code. That is, no duplication of source files. Otherwise, any maintenance of the source code becomes a lot more time consuming.

I looked at your repo for a few minutes, but couldn't figure out whether it involved duplicating the source files.

Matt

@ruskindantra
Copy link
Author

Unfortunately yes I have duplicated the files as they reside in a different namespace. I can convert them to a shared links but eventually .net core will deviate and you might end up having some duplicates and some not which might be worse than having all duplicates. Let's leave it as a fork then until we can come up with a better solution?! :)

@ruskindantra
Copy link
Author

Actually I lie, they do have the same namespace! So maybe I can try sharing them? And see how long we can do that until code deviates?

@mperdeck
Copy link
Owner

mperdeck commented Jul 8, 2017

Have a look at my package JSNLog. It has the same problem - needs a .net 4.x version and a core version:
https://github.com/mperdeck/jsnlog

Looking at jsnlog.csproj, you'll see it is a core style csproj (short, contains the nuget package definitions). That file is used to generate the nuget package for the core version.
Meanwhile, the file JSNLog.nuspec is used to generate the .net 4.x nuget package.

I use a powershell script to build and publish the entire jsnlog eco system. The relevant bit that builds the 2 nuget packages is ($version contains the version number):
`
# Build the jsnlog.AspNetCore package
# msbuild /t:pack uses the package definition inside the jsnlog.csproj file
msbuild /t:pack /p:Configuration=Release /p:PackageVersion=$version
Move-Item bin\release*.nupkg C:\Dev@NuGet\GeneratedPackages

# Build the jsnlog package
nuget pack JSNLog.nuspec -OutputDirectory C:\Dev\@NuGet\GeneratedPackages -Version $version

`

In case you need different code for 4.x and core versions, have a look at these lines in the jsnlog.csproj:
<PropertyGroup Condition="'$(TargetFramework)' == 'net452'"> <DefineConstants>NET452</DefineConstants> <DefineConstants>SUPPORTSXML</DefineConstants> </PropertyGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.6'"> <DefineConstants>NETSTANDARD</DefineConstants> </PropertyGroup>

Those variables are used in #if statements in the jsnlog code base.

For your core version of semantictypes, you could follow the same idea. You'd need to include a build script that takes care of building both the 4.x and core packages.

Lastly, please pull the latest jsnlog code. I just implemented a pull request to support XML serialization.

@ruskindantra
Copy link
Author

Can we just not port this to .net standard?

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

No branches or pull requests

2 participants