如何更改解决方案配置以修复Travis CI上的错误MSB4126



我正试图在我正在进行的一个开发项目中采用持续集成实践,所以我正在使用Travis CI。我所进行的项目是一个在Visual Studio中完美构建的游戏。但在推动我在GitHub上所做的任何更改后,当Travis试图构建它时,它总是失败。以下是我在Travis CI.上的作业日志中得到的错误消息

构建于2018年11月11日上午11:59:03开始。节点1上的项目"/home/travis/build/Jeryxem/Escapade/MyGameWin.sln"(默认目标(。/home/travis/build/Jeryxem/Escapade/MyGameWin.sln.metaproj:error MSB4126:指定的解决方案配置"Release |x86"无效。请使用"配置"one_answers"平台"属性(例如MSBuild.exe solution.sln/p:configuration=Debug/p:Platform="Any CPU"(指定有效的解决方案配置,或者将这些属性留空以使用默认解决方案配置。[/home/travis/build/Jeryxem/Escapade/MyGameWin.sln]完成构建项目"/home/travis/build/Jeryxem/Escapade/MyGameWin.sln"(默认目标(--失败。生成失败。

我的.travis.yml文件中只有这个:

language: csharp
solution: Escapade.sln

根据我所做的一些研究,我认为我需要编辑我的csproj文件来更改平台和/或配置的详细信息。以下是我的csproj文件的全部内容。

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug-Windows</Configuration>
<ProjectGuid>{A9DCAC72-BC77-4C33-BE70-BBFD31D7C798}</ProjectGuid>
<RootNamespace>Escapade</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>Escapade</AssemblyName>
<SuppressXamMacUpsell>True</SuppressXamMacUpsell>
<SuppressXamMacMigration>True</SuppressXamMacMigration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>WinExe</OutputType>
<ApplicationIcon>ResourcesSwinGame.ico</ApplicationIcon>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug-Windows|x86' ">
<Optimize>false</Optimize>
<OutputPath>binDebug</OutputPath>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>false</UseSGen>
<UseRefCounting>false</UseRefCounting>
<Profiling>false</Profiling>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
<PropertyGroup>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyLibsToOut</PrepareForRunDependsOn>
</PropertyGroup>
<ItemGroup>
<Content Include="Resourcespanelsmeta.txt" />
</ItemGroup>
<ItemGroup>
<Reference Include="SwinGame">
<HintPath>libSwinGame.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<WinLibs Include="libwin32*.dll" />
<None Include="Resourcesimagestilesoverlay_diamond.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesoverlay_emerald.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesoverlay_ruby.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesoverlay_sapphire.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_east.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_inner_1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_inner_2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_inner_3.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_north.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_northeast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_northwest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_south.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_southeast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_southwest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_vertex_northeast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_vertex_northwest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_vertex_southeast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_vertex_southwest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_wall_horiz.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_wall_vert.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_west.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesanimationsstartup.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesbundlesFileDialog.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesbundlessplash.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesfontsarial.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesfontscour.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesfontsmaven_pro_regular.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesfdFile.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesfdFolder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesFileDialog_Active.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesFileDialog_Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesFileDialog_Inactive.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesFileDialog_Scroll.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesFileDialog_ScrollSmall.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesSwinburne.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesimagesSwinGameAni.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcespanelsFileDialog.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcessoundserror.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcessoundsSwinGameStart.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesSwinGame.icns">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ResourcesSwinGame.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_pointnorth.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_pointsouth.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_pointwest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resourcesimagestilesrock_pointeast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Compile Include="Countdown.cs" />
<Compile Include="GameLevel.cs" />
<Compile Include="srcEntry.cs" />
<Compile Include="srcguiMetaHandler.cs" />
<Compile Include="srcLocation.cs" />
<Compile Include="srcmineralgemstoneSapphire.cs" />
<Compile Include="srcmineralgemstoneRuby.cs" />
<Compile Include="srcmineralgemstoneEmerald.cs" />
<Compile Include="srcmineralgemstoneDiamond.cs" />
<Compile Include="srcmineralgemstoneGemstone.cs" />
<Compile Include="srcmineralMineral.cs" />
<Compile Include="srcMovableObject.cs" />
<Compile Include="srcEntity.cs" />
<Compile Include="srcPath.cs" />
<Compile Include="srcPathNode.cs" />
<Compile Include="srcPlayer.cs" />
<Compile Include="srcTile.cs" />
<Compile Include="srcTileType.cs" />
<Compile Include="srcWorld.cs" />
<Compile Include="srcItem.cs" />
<Compile Include="srcInventory.cs" />
<Compile Include="srcguiGuiEnvironment.cs" />
<Compile Include="srcguiRenderer.cs" />
<Compile Include="srcguiFrame.cs" />
<Compile Include="srcguiGuiEvent.cs" />
<Compile Include="srcEscapade.cs" />
<Compile Include="srcBitmapMask.cs" />
<Compile Include="srcguiButton.cs" />
<Compile Include="Weapon.cs" />
<Compile Include="WeaponType.cs" />
<Compile Include="AttackDirection.cs" />
<Compile Include="GlobalConstants.cs" />
<Compile Include="Enemy.cs" />
<Compile Include="Projectile.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
</ItemGroup>
<ItemGroup />
<Target Name="CopyLibsToOut">
<Copy SourceFiles="@(WinLibs)" DestinationFolder="$(OutDir)" />
</Target>
</Project>

我需要更改什么以确保我的解决方案能够在Travis CI上构建而不会出现任何错误?知道如何提供有效的解决方案配置,这样我就不会再收到错误MSB4126了吗?

此问题最近在NET6.0中发生,值得发布解决方案。它实际上与错误描述无关。在Travis CI中,我通常有一个BUILD_CONFIG设置,它是master和release分支的release,以及开发分支的debug。我的.travis.yml文件有

script:
- chmod +x ./deploy.sh 
- ./deploy.sh

deploy.sh文件中有一行用于启动构建:它是为dotnetcore编写的,但也适用于NET5和NET6。

dotnet build -c $BUILD_CONFIG BOG.DropZone

我之所以出现这个错误,是因为我正在构建没有环境变量BUILD_CONFIG定义的开发分支。因此,它正在执行";dotnet build-c BOG.DropZone";这会产生各种奇怪的错误。

当我为开发分支添加环境变量(BUILD_CONFIG=debug(时,命令行工作正常。随后的构建给了我另一个错误,项目文件中的文件夹名称大小写不匹配(调试与调试(,但这是一个真正的错误。我解决了这个问题,现在效果很好。

似乎很多人都回避了这个问题。我的第一条线索应该是我的项目名称出现了错误(错误MSB4126:指定的解决方案配置"BOG.DropZone|Any CPU"无效(。

希望这能有所帮助。FWIW:.travis.yml和deploy.sh文件在这个解决方案中(构建一个应用程序和两个nuget包(。

github.com 上的BOG.DropZone

相关内容

  • 没有找到相关文章

最新更新