'Project file could not be loaded, data at root level is invalid, no XML in the project
I am trying to run a hello world C# code from command line and this is the batch file. Tried searching for it but most of the questions are about the XML file reader, I am not reading any XML files.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild "E:\a\c.cs" /p:Configuration=Debug;DeployOnBuild=True;PackageAsSingleFile=False;outdir=E:\a
and this is c.cs
class c {
public static void Main() {
System.Console.Clear();
System.Console.WriteLine("hey");
System.Console.ReadKey();
}
}
and the error
Solution 1:[1]
msbuild expects a project file or a solution file as input:
https://msdn.microsoft.com/en-us/library/ms164311.aspx
What you want to do is run the c# compiler directly:
Solution 2:[2]
If you are running dotnet with the following command while running.
dotnet run --project [project_name].dll
You can run the following instead of the above command.
dotnet [project_name].dll
Solution 3:[3]
Close the Visual Studio, going the arquivo projects and delete paste ".Vs" and start the Visual Studio
Solution 4:[4]
Check the project file(*.cproj). The file must have the correct Syntax.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Community |
Solution 2 | Furkan Do?anay |
Solution 3 | Edvanderson Lisboa |
Solution 4 | M Fa |