1

I have a C# project in VS. I want to build it using Microsoft.Build.Evaluation in other project.

i try this(find here)

Project pr = new Project(@"path\to\.sln");
pr.SetGlobalProperty("Release", "x86");
if (pr.Build())
    Logs = $"{DateTime.Now}: success";
else
    Logs = $"{DateTime.Now}: fail";

but on 1 line have error

The project file could not be loaded. Data at the root level is invalid, Line 2, position 1

then i try

        Project pr = new Project();
        pr.FullPath = @"path\to\.sln";
        pr.SetGlobalProperty("Release", "x86");
        if (pr.Build())
            Logs = $"{DateTime.Now}: success";
        else
            Logs = $"{DateTime.Now}: fail";

but it just give me fail

1
  • Did you ever find a solution for this problem? Commented Jul 11, 2022 at 8:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.