- Create wpf app .net 4.6.1 (by console app it is not reproducible on my machine).
- Reference Microsoft.Build 14.3.0 (but the same issue with latest version as well) nuget package
Run this code (replace with real *.proj file):
public MainWindow()
{
InitializeComponent();
Loaded += (sender, args) => BuildManager.DefaultBuildManager.Build(new BuildParameters(),
new BuildRequestData(@"e:\Tests\ConsoleApp7\ConsoleApp7\ConsoleApp7.csproj", new Dictionary<string, string>(), null,
new[] { "Build" }, null, BuildRequestDataFlags.ReplaceExistingProjectInstance));
}
It is okay for me now
- Reference the latest Microsoft.Web.Administration nuget package.
- Run the same code. As result I get the following exception:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'
Inner Exception: FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
What is the best way to resolve it?