MSBuildForUnity icon indicating copy to clipboard operation
MSBuildForUnity copied to clipboard

Errors in sample project when removed from the repo directory and rebuilt

Open MenelvagorMilsom opened this issue 6 years ago • 0 comments

Overview

While looking at the sample projects I noticed some warnings/errors showed up on rebuild of SimpleNuGetDependency. The errors only show if the sample project is moved outside of the msb4u repo. The errors do not repeat on subsequent builds, nor do they prevent simulation in the Unity editor.

C:\Users\nimilsom\Desktop\SimpleNuGetDependency.Unity\Assets\NewtonsoftDependency> dotnet msbuild NewtonsoftDependency.csproj -restore  -v:minimal -p:NuGetInteractive=true  -t:Rebuild -p:Configuration=Release
C:\Users\nimilsom\Desktop\SimpleNuGetDependency.Unity\Assets\NewtonsoftDependency\NewtonsoftDependency.csproj : warning NU1604: Project dependency MSBuildForUnity does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
C:\Users\nimilsom\Desktop\SimpleNuGetDependency.Unity\Assets\NewtonsoftDependency\NewtonsoftDependency.csproj : warning NU1604: Project dependency MSBuildForUnity does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
C:\Users\nimilsom\.nuget\packages\msbuildforunity\0.1.115888\buildCommon\UnityMetaFileGenerator.targets(147,5): error : MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild. [C:\Users\nimilsom\Desktop\SimpleNuGetDependency.Unity\Assets\NewtonsoftDependency\NewtonsoftDependency.csproj]
C:\Users\nimilsom\.nuget\packages\msbuildforunity\0.1.115888\buildCommon\UnityMetaFileGenerator.targets(147,5): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\dotnet\sdk\3.1.100\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property. [C:\Users\nimilsom\Desktop\SimpleNuGetDependency.Unity\Assets\NewtonsoftDependency\NewtonsoftDependency.csproj]

Here's a link to the full logs for these warnings/errors which include the callstack: https://gist.github.com/MenelvagorMilsom/c68be7ae3581b9abccac7809b13f45fd

Repro Steps

  • Use DownGit to download https://github.com/microsoft/MSBuildForUnity/tree/master/Samples/SimpleNuGetDependency.Unity.
    • Alternatively, clone or download the full msb4u repo and copy the SimpleNuGetDependency sample to a new location outside of the repo.
  • Modify Packages\manifest.json so that it uses the scoped registry for accessing the package.
"scopedRegistries": [
    {
        "name": "Microsoft",
        "url": "https://pkgs.dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_packaging/UnityDeveloperTools/npm/registry/",
        "scopes": [
            "com.microsoft"
        ]
    }
],
"com.microsoft.msbuildforunity": "0.8.3"
  • Open the Unity project and select Rebuild All Projects.
  • Observe errors printed to the editor console.

MenelvagorMilsom avatar Jan 14 '20 14:01 MenelvagorMilsom