MSBuildForUnity icon indicating copy to clipboard operation
MSBuildForUnity copied to clipboard

Can't Recreate sample

Open KuraiAndras opened this issue 5 years ago • 5 comments

I'm trying to recreate a scenario similar to the Integrated Dependencies sample, but it is not working properly.

The difference is that I'm trying to migrate from a scenario where the dependencies are already working via the unity package manager and dlls, and then migrating to msb4u dependencies.

When I recreate the dependencies via a project referenc to the shared project, I get errors when trying to build the project:

D:\ComplexEf\ComplexEf.Unity.Shared\Assets\ComplexEf.Unity.Shared.Dependencies.msb4u.csproj(33,3): error MSB4019: The imported project
D:\ComplexEf\ComplexEf.Unity.Shared\MSBuild\Projects\ComplexEf.Unity.Shared.Dependencies.msb4u.g.props" was not found. Confirm that the expression in the Import declaration
D:\ComplexEf\ComplexEf.Unity.Shared\MSBuild\Projects\ComplexEf.Unity.Shared.Dependencies.msb4u.g.props" is correct, and that the file exists on disk.

I checked and indeed the file is not there

On clean and rebuild i get the same result.

When tying to regenerate the c# sdk project:

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.SortedDictionary`2[TKey,TValue].get_Item (TKey key) (at <ae22a4e8f83c41d69684ae7f557133d9>:0)
Microsoft.Build.Unity.ProjectGeneration.Exporters.TemplatedExporter.TemplatedSolutionExporter.WriteProject (Microsoft.Build.Unity.ProjectGeneration.Exporters.TemplatedExporter.TemplatedWriter solutionWriter, System.Guid projectGuid, Microsoft.Build.Unity.ProjectGeneration.Exporters.SolutionProject project) (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/Exporters/TemplatedExporter/TemplatedSolutionExporter.cs:240)
Microsoft.Build.Unity.ProjectGeneration.Exporters.TemplatedExporter.TemplatedSolutionExporter.Write () (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/Exporters/TemplatedExporter/TemplatedSolutionExporter.cs:124)
Microsoft.Build.Unity.ProjectGeneration.UnityProjectInfo.ExportSolution (Microsoft.Build.Unity.ProjectGeneration.Exporters.IUnityProjectExporter unityProjectExporter, System.IO.FileInfo solutionFilePath, System.IO.DirectoryInfo generatedProjectsFolder) (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/UnityProjectInfo.cs:553)
Microsoft.Build.Unity.ProjectGeneration.MSBuildTools.RegenerateEverything (Microsoft.Build.Unity.ProjectGeneration.UnityProjectInfo unityProjectInfo, System.Boolean completeGeneration) (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/MSBuildTools.cs:342)
Microsoft.Build.Unity.ProjectGeneration.MSBuildTools.RefreshGeneratedOutput (System.Boolean forceGenerateEverything, System.Boolean forceCompleteGeneration) (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/MSBuildTools.cs:247)
Microsoft.Build.Unity.ProjectGeneration.MSBuildTools.GenerateSDKProjects () (at Library/PackageCache/[email protected]/Editor/ProjectGenerator/Scripts/MSBuildTools.cs:157)

the sample code is here

KuraiAndras avatar Feb 20 '20 00:02 KuraiAndras

@KuraiAndras The sample code provided didn't contain any reference to MSB4U as a package. Also, what DLL were you trying to reference?

Finally, what version of the package are you attempting to use? Try: 0.9.1-20200131.14

andreiborodin avatar Feb 22 '20 19:02 andreiborodin

Sorry, i think i wasn't clear: I have a sample project where i reference a .net standard project from unity which has nuget dependencies(MediatR, EntityFramework Core, morelinq).

I have managed to reference that project with the unity package manager in the past by adding an asmdef to it, and adding the required dlls (EF, MediatR, etc) to the unity shared project.

Now i want to use msb4u to reference this shared project. I added msb4u to the unity project, deleted the dll, and removed the package manager dependency form the unity project, and added a project reference in the msb4u.csproj to the shared project, just like shown in the IntegratedDependencies sample.

All the steps for this can be seen as individual commits in the sample project i linked on the feature/add-msb4u project,

I'm I have tried using msb4u version 0.9.1-20200131.14 and also 0.9.2-2020131.11, with unity version 2019.3.0f6

KuraiAndras avatar Feb 24 '20 07:02 KuraiAndras

It seems like the problem is with my unity version 2019.3

KuraiAndras avatar Mar 11 '20 22:03 KuraiAndras

It seems like the problem is with my unity version 2019.3

Very likely, I saw it repro in that as well. I haven't had a chance to look into this further than that for now, but will update this issue when I get a chance.

andreiborodin avatar Mar 12 '20 05:03 andreiborodin

@andreiborodin Any update on this?

KuraiAndras avatar Mar 24 '20 13:03 KuraiAndras