Wrox Programmer Forums
|
BOOK: Professional C# 6 and .NET Core 1.0
This is the forum to discuss the Wrox book Professional C# 6 and .NET Core 1.0 by Christian Nagel; ISBN: 978-1-119-09660-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 6 and .NET Core 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 16th, 2016, 10:56 AM
Authorized User
 
Join Date: Aug 2016
Posts: 11
Thanks: 0
Thanked 2 Times in 2 Posts
Default Chapt 2: Targeting Frameworks.

Just wondering how you got it to target both .NetCore and 4.6.

I chose "Console Application (.Net Core)" as the project type.
And ".Net Framework 4.6.1" was selected as the Framework.
Funny how you need to select a framework for a .Net Core app, but the framework type seems to be ignored.

At any rate, this is the project.json it creates:

{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},

"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

So when I compile it only creates the .Net Core version in the bin directory.
No 4.6 version.
I guess I would have to manually add that framework into the json file?
 
Old November 16th, 2016, 11:01 AM
Wrox Author
 
Join Date: Sep 2010
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts
Default

To target multiple frameworks, you need to add this manually. The top selection for .NET Framework 4.6 has no meaning for .NET Core projects. To create binaries for both frameworks, add net46 to the frameworks section. However, be aware that Microsoft.NetCore.App can't be a dependency of .NET 4.6, thus you need to move this dependency to the dependencies section within the netcoreapp1.0 section.

Hope this helps.

Cheers,
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
 
Old November 16th, 2016, 01:14 PM
Authorized User
 
Join Date: Aug 2016
Posts: 11
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Thanks - I would have guessed most of that.
But I would not have guessed this part:
"However, be aware that Microsoft.NetCore.App can't be a dependency of .NET 4.6, thus you need to move this dependency to the dependencies section within the netcoreapp1.0 section."

Good to know.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Portal Frameworks and Web Parts!!! msdnman BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 8 March 4th, 2007 12:29 AM
targeting external page in another page's IFRAME nancy HTML Code Clinic 1 March 30th, 2006 03:22 PM
Objective-C & C++ frameworks F. C. Rock BOOK: Beginning Mac OS X Programming 3 November 1st, 2005 06:55 PM
Targeting main window from an iframe Sushifiend3000 Javascript How-To 9 November 26th, 2004 11:55 AM
targeting a function harpua Flash (all versions) 0 February 19th, 2004 07:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.