Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Project.json doesn't support portable frameworks when including output from .csproj #608

Closed
dsplaisted opened this issue Sep 5, 2014 · 8 comments

Comments

@dsplaisted
Copy link

To reference a portable project from an ASP.NET vNext project, you can drop a project.json file next to the portable .csproj, as described here.

In this case, I would expect to be able to use the same framework name as NuGet uses for the lib folder. But if I use something like "portable-net45+win8+wp8+k10", I get an error:

System.ArgumentException: The profile part of a portable target framework must not contain the '-' character.
Parameter name: profilePart
   at NuGet.VersionUtility.ValidatePortableFrameworkProfilePart(String profilePart)
   at NuGet.NetPortableProfile.Parse(String profileValue)
   at Microsoft.Framework.Runtime.Project.ParseFrameworkName(String targetFramework)
   at Microsoft.Framework.Runtime.Project.BuildTargetFrameworkNode(KeyValuePair`2 targetFramework)
   at Microsoft.Framework.Runtime.Project.BuildTargetFrameworksAndConfigurations(JObject rawProject)
   at Microsoft.Framework.Runtime.Project.GetProject(String json, String projectName, String projectPath)
   at Microsoft.Framework.Runtime.Project.TryGetProject(String path, Project& project)
   at Microsoft.Framework.Runtime.ApplicationHostContext.get_Project()
   at Microsoft.Framework.DesignTimeHost.ApplicationContext.Initialize(String appPath, FrameworkName targetFramework, String configuration)
   at Microsoft.Framework.DesignTimeHost.ApplicationContext.Calculate()
   at Microsoft.Framework.DesignTimeHost.ApplicationContext.DoProcessLoop()
   at Microsoft.Framework.DesignTimeHost.ApplicationContext.ProcessLoop(Object state)
@bricelam
Copy link
Contributor

bricelam commented Sep 5, 2014

I believe you need to use the beautiful format .NETPortable,Version=v4.5,Profile=Profile111.

@dsplaisted
Copy link
Author

I would expect to be able to use the same shortened framework names as NuGet does. After all you use net45 in the project.json instead of .NETFramework, Version=v4.5.

Plus, we really don't want people to have to specify the profile number. It's arbitrary and doesn't have any meaning in and of itself. The list of platforms in something like portable-net45+win8+wp8+k10 describes the intent and is easier to understand.

@davidfowl
Copy link
Member

Fortunately this will never be a first class feature. It was hacked in for compatibility so the priority on this is pretty low IMO. FYI it might work if you remove the portable- and just specify the combined frameworks but this is a very untested areas so expect to find problems with it.

@gulbanana
Copy link

If this is not going to be a first class feature, then what is the supported way to build a system like this:

  • common vbproj or csproj containing code that can run on .NET 4.6 or Core CLR
  • frontend project.json containing an asp.net 5 library/app
  • frontend vbproj or csproj containing a desktop, store, or phone library/app

The obvious way would be to make the common project a PCL, but is there a different preferred means?

@davidfowl
Copy link
Member

What doesn't work?

@gulbanana
Copy link

Here's a minimal solution demonstrating the scenario:
http://thomascastiglione.com/MultipleFrontends.zip

There are a couple of projects designed for different verticals, each referencing a common library which uses the Debug.WriteLine() api (available on all iterations of .NET). You'll see there's one compile error, from the ASP.NET 5 frontend - it isn't able to reference the project CommonLibrary. Trying to add it as a reference using visual studio fails, and this issue seems to be about doing the same thing via project.json.

@davidfowl
Copy link
Member

This actually works fine and compiles for me. I had to add a reference to System.Runtime in the aspnet50 section but adding a reference in visual studio works.

@gulbanana
Copy link

Interesting. I'm using VS2015 ctp 5, and the Add Reference dialog brings up an error reading "The following projects are not supported as reference: CommonLibrary". I tried adding it by hand, producing this project.json file:
http://pastebin.com/tShnddcA

The error in that case is CS0103 The name 'CommonLibrary' does not exist in the current context

But if this is going to be supported by whatever means, that's fine- bugs in the moment don't matter.

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

No branches or pull requests

4 participants