I have a solution with .NET Framework projects in mostly F# and then a few in C#. I use Paket instead of NuGet for packet management. Now I've added my first .NET Standard 2.0 library to this solution.
When I run my build script, which runs another build script, which calls devenv to compile, there is an error that says the project's obj\project.assets.json file is missing. It is actually generated while compiling, but only if one of the other projects are compiled. Why then it is reported as missing is a little bit weird.
If I run just the inner script, there's no problem. If I open VS and compile, there's no problem. Funny.
I'm not quite sure how stuff works - or not. But after googling it seems this file should be put there before compiling with devenv (Visual Studio), and not put there by devenv.
I ran Paket restore. That didn't produce the missing project.assets.json.
I googled my way to "dotnet restore". When running this, I get this error on several of the older projects.
MSB4020: The value "" of the "Project" attribute in element <Import> is invalid.
So the question is, what do I do now?
I finally figured out that after the Paket restore, I could run this command on only the new .NET Core project, thereby avoiding the errors from the other projects in the solution.
dotnet restore TheProject
Then the missing file was generated before compile, and the rest of the build script ran to completion.
PS (edit): This is not a perfect solution for me, because I have to add that line to my build script for every .NET Standard and .NET Core project in my solution. Having to maintain the script like that is not ideal. For that reason I will look into what has to be done to get rid of the MSB4020 error. Until then, this serves as a good workaround.
I can advise you to try changing the project file (.fsproj) as follows:
Import Project="$(FSharpTargetsPath)"
Condition="Exists('$(FSharpTargetsPath)')"
Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')"
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