Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

netstandard project support #1622

Merged
merged 33 commits into from Oct 4, 2016
Merged

netstandard project support #1622

merged 33 commits into from Oct 4, 2016

Conversation

mhutch
Copy link
Member

@mhutch mhutch commented Sep 12, 2016

Add support for converting PCLs to netstandard projects. This allows MD to build against netstandard.

So we don't leave broken state if there's a save error
Invalidate on project reload and, if necessary, on project.json save.
@mrward
Copy link
Member

mrward commented Sep 13, 2016

The NuGet addin changes all look good to me.

I have not reviewed the other changes.

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />

Choose a reason for hiding this comment

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

I'm just curious. Is there any reason for using really old versions?

Copy link
Contributor

Choose a reason for hiding this comment

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

The trick is that you have to change it everywhere in MonoDevelop and anything that builds on top of MonoDevelop. I think it is a case of someone going through and very carefully updating everything :)

Choose a reason for hiding this comment

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

There's only one way to move forward :), Can't you use binding redirects?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I did try that before but it caused issues with the Xamarin addins and I didn't have a compelling reason to chase them down right now: #1589

}

if (hasOtherVersions && string.IsNullOrEmpty (sfx.MonoSpecificVersionDisplayName))
label += " or later";
Copy link
Member

@mrward mrward Sep 15, 2016

Choose a reason for hiding this comment

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

Missing a translation here for "or later". Although this looks like it was already missing in master.

For netstandard projects to be able to reference a PCL, they
need to reference Microsoft.NETCore.Portable.Compatibility, but
it's not obvious, so add it by default.
https://bugzilla.xamarin.com/show_bug.cgi?id=44597

Even though NuGet iteself prefers "NuGet-style" short TFMs, the
NuGet MSBuild tasks don't understand them.


//auto-restore project.json files when they're saved
void FileChanged (object sender, FileEventArgs e)
Copy link
Member

Choose a reason for hiding this comment

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

The FileChanged event fires when a NuGet package is being added with the Add Packages dialog or removed from the Solution pad. The install/remove process does the restore itself. So it looks like we end up restoring again here when there is no need to.

Just wondering if we should disable this auto restore if a normal NuGet package operation is being run. Or maybe only look for changes to the project.json file if it is being edited in the text editor - although that would miss changes made outside the IDE.

The NuGet addin also files the FileChanged event for the project.json file to ensure it is reloaded in the text editor if it is open although this seems to not be working with the netstandard branch for some reason. If I comment out the FileService.FileChanged line then the project.json file is refreshed in the text editor.

Copy link
Member

Choose a reason for hiding this comment

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

OK I put a fix for this on a separate branch - https://github.com/mono/monodevelop/tree/netstandard-prevent-restore-when-adding-nuget-package

The restore check is not done if the NuGet addin is running an operation.

@RussellHaley
Copy link

                                                                                                                                                                                                                                                                                                                                                                                                                          Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.                                                                                                                                                                                                                From: Matt WardSent: Friday, September 30, 2016 8:06 AMTo: mono/monodevelopReply To: mono/monodevelopSubject: Re: [mono/monodevelop] netstandard project support (#1622)@mrward commented on this pull request.

In main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs:

@@ -134,6 +137,64 @@ void WorkspaceItemUnloading (object sender, ItemUnloadingEventArgs e)
LoggingService.LogError ("Error on unloading workspace item.", ex);
}
}

  • }
    -}
  •   //auto-restore project.json files when they're saved
    
  •   void FileChanged (object sender, FileEventArgs e)
    

OK I put a fix for this on a separate branch - https://github.com/mono/monodevelop/tree/netstandard-prevent-restore-when-adding-nuget-package

The restore check is not done if the NuGet addin is running an operation.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/mono/monodevelop","title":"mono/monodevelop","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/mono/monodevelop"}},"updates":{"snippets":[{"icon":"PERSON","message":"@mrward commented on #1622"}],"action":{"name":"View Pull Request","url":"https://github.com/mono/monodevelop/pull/1622"}}}

@slluis
Copy link
Member

slluis commented Oct 3, 2016

This is ok to merge, once the conflicts are resolved.

@mhutch mhutch merged commit 99563ca into mono:master Oct 4, 2016
@mhutch mhutch deleted the netstandard-projects branch April 27, 2018 14:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants