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

Discussion: Updates to project.json schema #1418

Closed
ajaybhargavb opened this issue May 2, 2016 · 56 comments
Closed

Discussion: Updates to project.json schema #1418

ajaybhargavb opened this issue May 2, 2016 · 56 comments

Comments

@ajaybhargavb
Copy link
Contributor

Discussion for aspnet/Announcements#175

@smbecker
Copy link

smbecker commented May 2, 2016

Where should define go? I didn't see it in the list of changes but I assume that compilationOptions is going away entirely.

@smbecker
Copy link

smbecker commented May 2, 2016

Also, does this affect the shared option?

@ajaybhargavb
Copy link
Contributor Author

Where should define go?

compilationOptions is being renamed to buildOptions. So all options including define still exists in buildOptions.

Also, does this affect the shared option?

No. shared still exists and is not deprecated.

@guardrex
Copy link
Contributor

guardrex commented May 3, 2016

@ajaybhargavb Is copyToOutput functional?

I added ...

"copyToOutput": {
    "include": [ "Views", "wwwroot", "Logs" ]
}

... to buildOptions, but Debugging in VS Code fails to trigger these folders into Debug. I also tried dotnet build -f netcoreapp1.0 -r win81-x64 -c Debug, which also failed to get these folders/files into output. [CLI version -2609]

@Tasteful
Copy link

Tasteful commented May 3, 2016

Is it possible to some type of global version numbering?

When using DNX it was posible to use the DNX_BUILD_VERSION environment variable to change the * part of version number 1.0.0-*. If you have say 20 different class assemblies that always is released together and the version number for them should always be the same, can I set an environment variable for that or use global.json. I mean the 1.0.0 part so that can be set on global way to 2.0.0 without changing all the individual project.json:s.

@guardrex
Copy link
Contributor

guardrex commented May 3, 2016

@Tasteful It's been backlogged ... https://github.com/dotnet/cli/issues/551 and https://github.com/dotnet/cli/issues/549

@Alxandr
Copy link
Contributor

Alxandr commented May 3, 2016

What about "debugType"?

@smbecker
Copy link

smbecker commented May 4, 2016

Is it expected that if I specify "includeFiles" that I also need to specify "include"? In one of my apps, I am including a file from a different directory. When I do that, I get an error that states that Program does not contain a static 'Main' method suitable for an entry point?, which led me to believe that it wasn't actually including all of the source code. I had to then specify "include": ["**/*.cs"] for it to build correctly. With that it builds but then I also get a warning CS2002: Source file 'obj\Debug\net451\dotnet-compile.assemblyinfo.cs' specified multiple times. Is this expected?

@ajaybhargavb
Copy link
Contributor Author

@smbecker, this issue was because the defaults weren't used. This was fixed in https://github.com/dotnet/cli/issues/2819. Updating to the latest cli should fix this problem.

@smbecker
Copy link

smbecker commented May 4, 2016

awesome, thanks

@sandorfr
Copy link
Contributor

sandorfr commented May 7, 2016

Is there a specific discussion thread regarding the announcement about the new unified xproj/project.json and csproj. There is a lot of comments regarding this and I might be sane to consult with the community before moving forward.

I quite like the new project.json format and I assume I'm not the only one. I'm very concerned about the msbuild comeback, unless you have some "Build core 1.0" plans and will provide a modern xsln, xproj solution with an efficient DSL instead of what msbuild currently is.

@nmocruz
Copy link

nmocruz commented May 8, 2016

@Alxandr to enable the use of portable PDBs I added "debugType" to "buildOptions" and the debug is working ok now.

@ajaybhargavb
Copy link
Contributor Author

Is there a specific discussion thread regarding the announcement about the new unified xproj/project.json and csproj

cc' @davidfowl @DamianEdwards @Eilon

@DamianEdwards
Copy link
Member

@sandorfr not as yet. We plan to provide further information on this in the near future as we get closer to actually doing that work (it's slated for after RTM of the runtime, i.e. after June).

@simonech
Copy link

So, basically, RTM will ship with project.json? and later it will change?

@sandorfr
Copy link
Contributor

TLDR: I love project.json for it simplicity and efficiency. Msbuild is a cryptic old fashioned xml based build system and it broke my heart to many times. Support is useful but should be opt-in. You did great with project.json, please keep something as simple as this :).

@DamianEdwards I just watched the QnA of the last community standup, and you got me even more worried :( than I was about this news. Maybe I miss some important points that lead to this decision, and this is why I'm asking a discussion thread. If you expose the core reasons (the why not the how) behind this move, the community (including me) will stop complaining or will come up with a better approach proposal.

With the current project.json/xproj approach we have the following advantages :

  • slick .net build story without the need of an additional old school build system (a.k.a. msbuild)
  • very simple learning curve for the newcomers and welcome similarity with npm
  • simple & unique xplat file format
  • dead simple nuget package generation story
  • easy to edit with any text editor (no need for an IDE)

It has some drawbacks one is json itself which does not support comments and trailing comma on arrays (but project.yaml format could solve both issues)

If we switch to an msbuild file format :

I definitely understand that Microsoft and some of its customers have built great build pipelines around msbuild and that .net core must play nicely with msbuild. On the other hand, I don't think creating a tight link between msbuild and .net core is mandatory nor the way to go. The out of the box story should remain as dead simple as it is with RC2 today and additional development and build tools like msbuild, vs code, vs 15, Jetbrains Riders should be opt-ins on top of it.

@MaximRouiller
Copy link

I also disagree with the move.

I get that other teams want to keep their csproj but for me, it's a step backward. xproj was sold to us as being "just required by Visual Studio for tooling support". And now we're moving back to csproj?

How are we going to handle dependency now? #1433

How are we going to handle targets? Supporting csproj means integrating targets. How is that going to integrate?

@conniey
Copy link
Member

conniey commented May 12, 2016

Does the current version of the .NET CLI understand these changes? I have some compiler directives being defined in my project.json but it does not seem to be compiling with those defines when I run dotnet build?

{
  "buildOptions": {
    "define": [ "ICU_VER_56" ],
    "compile": {
      "exclude": [ "Properties/*.cs" ]
    }
  }
}

@andrebaltieri
Copy link

We are running the RC1, going to RC2 and thinking about keep or change one of the main files of the Core app?

I strongly agree with @sandorfr. Nowadays a lot of people are familiar with NPM, json files and project.json.

+1 to keep project.json!

@gustavoferrazfontes
Copy link

Why do change this now? keep with project.json

@justinhhorner
Copy link

+1 for keeping project.json

@alexbocharov
Copy link

I think you need to unambiguously leave project.json. Xml is a bad idea

@yanjustino
Copy link

keeping projecto.json, please!

@alexsandro-xpt
Copy link

alexsandro-xpt commented May 12, 2016

Keep project.json, xml .csproj is really bad, xml is inhuman, is not friendly, is not editable without a tool, json is more friendly, readable by default by javascript.

And about MSBuild, it's should upgraded to late.

Do not break the ASP.net revolution.

@nfplee
Copy link

nfplee commented May 12, 2016

+1 for keeping project.json

@jedielson
Copy link

+1 for keeping project.json

@feliperochadev
Copy link

+1 for keeping project.json please team hear the community!

@mdmoura
Copy link

mdmoura commented May 20, 2016

+2000 for keeping project.json. That is one of the nice features in ASP.NET Core. Please, do not go back to MSBuild or XML configuration files ...

@MaximRouiller
Copy link

@mdmoura I don't think they'll be able to meet a deadline of "end of June" if they are to transition all .NET projects and Xamarin to a new project.json format. Just in terms of tooling, it would be a major endeavor that could take years to complete and get everyone off of the MSBUILD wagon.

My view of this is that it's a "necessary evil" that we'll need to live with for the time being. I'm hoping that the future will be different than MSBUILD.

Just my 2 cents.

@DavidObando
Copy link
Member

@ajaybhargavb I have a minor observation. In the post we have this example:

{
  "runtimeOptions": {
    "gcServer": false,
    "gcConcurrent": true
  }
}

Could we change this to say "gcServer": true? Code snippets like that end up being what people put in their projects, and if I were to give people a default, I'd argue servergc is preferable.

@Eilon
Copy link
Member

Eilon commented May 25, 2016

@DavidObando good suggestion, I made the change.

@halter73
Copy link
Member

@DavidObando @Eilon In a comment above, I posted a link to https://github.com/dotnet/cli/blob/v1.0.0-rc2/Documentation/specs/runtime-configuration-file.md#file-format which I found has a more up-to-date format for "runtimeOptions". As of RC2, the "runtimeOptions" section of .runtimeconfig.json is copied verbatim (with the exception of the target parameter) from the same section in project.json.

At the time, I didn't update the announcement itself, because I figured that was supposed to reflect the state of things at the point in time the announcement was made. But since we're accounting for people copying code snippets from the announcements, I decided to update the announcement now to show the current format. E.g:

"runtimeOptions": {
    "configProperties": {
        "System.GC.Server": true,
        "System.GC.Concurrent": true
    }
}

@Eilon
Copy link
Member

Eilon commented May 26, 2016

@halter73 ah sure, that's fine.

@dazinator
Copy link

dazinator commented Jun 3, 2016

Just trying to migrate an rc1 project.json to rc2 and wanted to check something.

In RC1 I have this in my project.json files:

{
"exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ],
}

According to the docs, this ensures those paths are excluded from: CompileList, PreprocessList, SharedList, ResourceList, and ContentList.

What does this look like for an equivalent RC2 project.json?

My guess is:


{
  "buildOptions": {  
      "compile": {      
          "exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ]
       },
      "embed": {
          "exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ] 
      },
      "copyToOutput": {      
        "exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ]
      }
  }
}

@ajaybhargavb
Copy link
Contributor Author

@dazinator, the equivalent in RC2 would be

{
  "buildOptions": {  
      "compile": {      
          "exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ]
       },
      "embed": {
          "exclude":  ["wwwroot","node_modules","shadowed","artifacts", "modules" ] 
      }
  }
}

copyToOutput and publish don't include anything by default.

@dazinator
Copy link

@ajaybhargavb - thank you.

@lgreenlee
Copy link

Thanks for the great documentation on these settings. One question, when will the project.json file be phased out, and what will VS Code users need to do to support the transition?

@guardrex
Copy link
Contributor

@lgreenlee They haven't announced an ETA. We only know "post RTM." There is some additional info here: dotnet/docs#550. You can see planning issues open now: https://github.com/dotnet/cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20msbuild. You can see some WIP here: dotnet/cli#3680.

AFAICT dotnet restore/build/pack/publish will get under-the-hood changes to work with MSBuild. Therefore, the change will be somewhat or mostly transparent in terms of using CLI commands to get things done. They have stated that tooling will help convert project.json into .csproj.

@guardrex
Copy link
Contributor

@lgreenlee Oh ... and just for fun ... check this out ... I must have WAY too much free time on my hands. 😄 https://github.com/GuardRex/GuardRex.JsonToCsprojConverter

@lgreenlee
Copy link

@guardrex That is great! I'll star that for future use. I just put this together today: https://github.com/42north/ubuntu-xenial-dcp-sample-app which is why I was asking.

@FransBouma
Copy link

FransBouma commented Jul 1, 2016

(preview 2, RTM)

"buildOptions": {
    "xmlDoc": true,
}

Gives foldername.xml, not name.xml, so the assembly is called e.g. MyOrg.Tools.SomeLib.dll, but as it is located in 'src' folder, the xml file is called src.xml, while it should be called MyOrg.Tools.SomeLib.xml

@guardrex
Copy link
Contributor

guardrex commented Jul 1, 2016

@FransBouma It honors buildOptions > outputName. I think if you set that to MyOrg.Tools.SomeLib it will work ... I think. 😄

I guess csproj offers finer control, including the path. I just saw this ...

<DocumentationFile>$(MSBuildProjectDirectory)\$(OutputPath)$(MSBuildProjectName).XML</DocumentationFile>

@FransBouma
Copy link

'outputName' indeed works. Strange as the compiler honors 'name' for assembly name, but outputName is only honored for xmloutput. Oh well...

Btw, couldn't find docs about this.

@guardrex
Copy link
Contributor

guardrex commented Jul 4, 2016

Yikes! ... yeah ... that's a sad 😢 story that will likely not be addressed due to the move to csproj. The docs are either incomplete or out-of-date. We would expect to see outputName at ...

http://json.schemastore.org/project
https://docs.nuget.org/consume/projectjson-format
https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json

... but it only even appears in the first one, and then we find no description for it.

Presumably for csproj, we'll have AssemblyName and DocumentationFile to cover naming, and it seems that the WIP on that transition is going well and fast. 👍

@Joel-S-Black
Copy link

I'm having problems with publishOptions. I'm trying to include a file "Serilog.FullNetFx.dll" in my publish output along with the rest of the DLLs. When I do this:

"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
],
"includeFiles": "./bin/Debug/net46/win7-x64/Serilog.FullNetFx.dll"
},

The file is published, but to a new "..\bin\Debug\net46\win7-x64" location. I need it to be published to ".." Is there a way to specify a different source path from destination path? When I have tried this:

"includeFiles": "./Serilog.FullNetFx.dll" , I get a file not found error on publish. I looked through this documentation: aspnet/Announcements#175 (comment) and haven't found any clarification as to how this should be used.

@Eilon
Copy link
Member

Eilon commented Dec 30, 2016

@jllblk I recommend asking on https://github.com/dotnet/cli/issues/, which is where the publishOptions feature is implemented. You might also want to mention why you need to explicitly include that DLL - those are normally included only when needed by the build system and are rarely, if ever, explicitly published.

@moozzyk
Copy link
Contributor

moozzyk commented Dec 30, 2016

@jllblk - look at "mappings"

@aspnet-hello
Copy link

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

@aspnet-hello aspnet-hello removed this from the Discussions milestone Dec 31, 2017
natemcmaster pushed a commit that referenced this issue Oct 17, 2018
Don't install 2.0 on linux-musl
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 4, 2019
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