I did not find project.json in visual studio 2017 RC. Has this been removed in this version or am i missing something ? How do they store list of dependencies now if it is removed ?
Going forward, .Net Core is going to be based on msbuild, which means that it's going to use *.csproj instead of project.json. Package references are now also stored in the *.csproj file.
For more information, read Announcing .NET Core Tools MSBuild “alpha” on the .NET Blog and High level overview of changes in CLI Preview 3 in .NET Documentation.
For example, if you had this in your project.json:
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Newtonsoft.Json": "9.0.1"
}
You will now have *.csproj containing:
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
</PackageReference>
Microsoft.NETCore.App
, the SDK is just a single attribute on the root element and package versions can be specified using an attribute. In my opinion, even if you dislike the XML syntax, the increased power and unification with all other project types is worth it. –
Uprear project.json
. Right now, compiling my console app only creates a DLL in the /Debug folder. –
Fourwheeler <RuntimeIdentifiers>
in your csproj and then use dotnet publish
for that RID. –
Uprear csproj
externally? –
Fourwheeler Refer Given Link
https://learn.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj
Project.json
{
"buildOptions": {
"warningsAsErrors": true,
"nowarn": ["CS0168", "CS0219"],
"xmlDoc": true,
"preserveCompilationContext": true,
"outputName": "Different.AssemblyName",
"debugType": "portable",
"allowUnsafe": true,
"define": ["TEST", "OTHERCONDITION"]
}
}
Solution->Right Click ->Edit Project.csporj
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);CS0168;CS0219</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Different.AssemblyName</AssemblyName>
<DebugType>portable</DebugType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);TEST;OTHERCONDITION</DefineConstants>
</PropertyGroup>
In Solution Explorer:
- Right Click on the Project
- Select Edit (YourProjectNameHere).csproj
A window should appear allowing you to view the XML version of the .csproj. The dependencies will be listed here under the PackageReference description.
© 2022 - 2024 — McMap. All rights reserved.