As of preview3 dotnet new
produces a csproj, and both dotnet restore
and dotnet build
fail against a project.json and/or an xproj.
For instance, running dotnet restore
against a directory that has both a project.json and an xproj gives this error.
...xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Further, running it against a directory that has only a project.json gives this error.
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Without using Visual Studio, how can we convert an existing project.json and/or xproj to a csproj?
What is a CSProj file? Files with CSPROJ extension represent a C# project file that contains the list of files included in a project along with the references to system assemblies. When a new project is initiated in Microsoft VIiual Studio, you get one . csproj file along with the main solution (. sln) file.
Right click your project and select "Edit ProjectName. csproj" to view the file.
json file means to an ASP.NET Core project: Let's explore project. json file's structure and learn how to use it effectively. Apart from the default debug and release build configurations built into the runtime, we can specify new build configurations or override debug and release in the project.
The way to do it is as follows (for WebJobs and class library type projects): Right click the packages. config and click the option to migrate to the new PackageReferences style. This will move all the package references in your csproj file and get rid of the packages.
There is a dotnet migrate
command.
The dotnet migrate command will migrate a valid Preview 2 project.json based project to a valid Preview 3 csproj project.
We can find detailed help on this command by running dotnet migrate -h
(even though dotnet -h
does not list the command).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With