Dotnet 构建返回不同的结果
Dotnet build is returning different results
我在生成新的统一脚本后尝试构建我的 *.csproj 时遇到了一个奇怪的问题。
让我解释一下工作流程。
首先,我要从 Unity 主目录中删除所有旧的 *.csproj 文件。
然后我使用以下脚本生成全新的项目文件
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
foreach (var type in assembly.GetTypes())
{
if (type.FullName == "Packages.Rider.Editor.ProjectGeneration.ProjectGeneration")
{
var projectGeneration = Activator.CreateInstance(type);
type.GetMethod("Sync").Invoke(projectGeneration,null);
EditorApplication.Exit(0);
}
}
}
接下来我尝试通过 cmd 命令构建每个 *.csproj:dotnet build C:\Projects\xxx\xxx\*.csproj --force --no-restore
这就是奇怪的事情发生的地方。命令的第一个 运行 总是返回很多错误和警告,但每次的实际数量都不一样。第二次是减少它们的数量,第三次 运行 通常不会产生错误,只会出现一些警告。
我知道,我没有得到相关的结果,因为应该出现的警告在 运行 秒后没有指出。
这是出现的一些错误
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\ARFoundation.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\xxx_OclussionCulling.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\QuickGraph.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\Unity.XR.Interaction.Toolkit.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
我的问题是为什么会发生这种情况,我该如何解决?主要目标是自动构建,但我必须单独构建每个 *.csproj,因为我需要从构建中排除一些 *.csproj。
好的,所以我前段时间找到了解决方案。我的问题是,我没有按照正确的顺序构建项目,这在这种情况下至关重要。
工程构建的有效顺序保存在主*.sln文件中。当你想手动构建 *.csproj 文件时,你必须知道正确的顺序。
我在生成新的统一脚本后尝试构建我的 *.csproj 时遇到了一个奇怪的问题。 让我解释一下工作流程。
首先,我要从 Unity 主目录中删除所有旧的 *.csproj 文件。 然后我使用以下脚本生成全新的项目文件
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
foreach (var type in assembly.GetTypes())
{
if (type.FullName == "Packages.Rider.Editor.ProjectGeneration.ProjectGeneration")
{
var projectGeneration = Activator.CreateInstance(type);
type.GetMethod("Sync").Invoke(projectGeneration,null);
EditorApplication.Exit(0);
}
}
}
接下来我尝试通过 cmd 命令构建每个 *.csproj:dotnet build C:\Projects\xxx\xxx\*.csproj --force --no-restore
这就是奇怪的事情发生的地方。命令的第一个 运行 总是返回很多错误和警告,但每次的实际数量都不一样。第二次是减少它们的数量,第三次 运行 通常不会产生错误,只会出现一些警告。
我知道,我没有得到相关的结果,因为应该出现的警告在 运行 秒后没有指出。
这是出现的一些错误
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\ARFoundation.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\xxx_OclussionCulling.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\QuickGraph.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\Unity.XR.Interaction.Toolkit.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
我的问题是为什么会发生这种情况,我该如何解决?主要目标是自动构建,但我必须单独构建每个 *.csproj,因为我需要从构建中排除一些 *.csproj。
好的,所以我前段时间找到了解决方案。我的问题是,我没有按照正确的顺序构建项目,这在这种情况下至关重要。
工程构建的有效顺序保存在主*.sln文件中。当你想手动构建 *.csproj 文件时,你必须知道正确的顺序。