我有一个内置在。net 5中的应用程序,我设置了一个应用程序的exe图标,并带有一个占位符。我现在正试图用一个适当的图标取代说占位符。然而,由于某些原因,当我构建发布构建时,它仍然使用旧的占位符图标,尽管我从项目中删除它并将其设置为新的。最重要的是,当我在调试模式下构建时,它使用正确的图标,但在发布模式下,它使用旧的占位符。
我已经尝试在项目属性中设置这个,并在.csproj文件中指定新图标的路径,但都没有成功。下面是.csproj文件的内容,对于上下文,Logo是新的图标,而LogoTemp是旧的占位符。如有任何帮助,我将不胜感激
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<RootNamespace>LPG_Launcher</RootNamespace>
<UseWPF>true</UseWPF>
<Company>LowPoly Games</Company>
<Authors>LowPoly Games</Authors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<TransformOnBuild>true</TransformOnBuild>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<PlatformTarget>x64</PlatformTarget>
<TransformOnBuild>true</TransformOnBuild>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<TransformOnBuild>true</TransformOnBuild>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<PlatformTarget>x64</PlatformTarget>
<TransformOnBuild>true</TransformOnBuild>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Optimize>true</Optimize>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=""$(ProjectDir)..Build AssistantbinReleaseBuild Assistant.exe" "MakeDir$(ConfigurationName)"
if $(ConfigurationName) == Release (
 del /S *.pdb
 "$(ProjectDir)..Build AssistantbinReleaseBuild Assistant.exe" "MoveGames"
 
 "$(ProjectDir)..Build AssistantbinReleaseBuild Assistant.exe" "CheckInstallers"
)" />
</Target>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TransformOnBuild>true</TransformOnBuild>
<OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<PackageIcon></PackageIcon>
<PackageIconUrl />
<ApplicationIcon>Logo.ico</ApplicationIcon>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Compile Remove="InstallerBuildAssistant.cs" />
<Compile Remove="InstallerInstallerVersionControl.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="FontsBebasNeueBold.ttf" />
<None Remove="InstallerBuildAssistant.exe" />
<None Remove="InstallerInstallerVersionControl.exe" />
<None Remove="ResourcesClose.png" />
<None Remove="ResourcesFG.png" />
<None Remove="ResourcesGHGLogo.png" />
<None Remove="ResourcesHCPlus" />
<None Remove="ResourcesHCPlus.png" />
<None Remove="ResourcesISPLogo.png" />
<None Remove="ResourcesLogo.ico" />
<None Remove="ResourcesMinimise.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="{d37e2a3e-8545-3a39-9f4f-31827c9124ab}">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>4</VersionMinor>
<VersionMajor>2</VersionMajor>
<Guid>d37e2a3e-8545-3a39-9f4f-31827c9124ab</Guid>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="VersionAutoIncrementer.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>VersionAutoIncrementer.txt</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
<ItemGroup>
<Folder Include="GameData" />
</ItemGroup>
<ItemGroup>
<Resource Include="FontsBebasNeueBold.ttf">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="ResourcesClose.png" />
<Resource Include="ResourcesFG.png" />
<Resource Include="ResourcesGHGLogo.png" />
<Resource Include="ResourcesHCPlus.png" />
<Resource Include="ResourcesISPLogo.png" />
<Resource Include="ResourcesLogo.ico" />
<Resource Include="ResourcesMinimise.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov16.0TextTemplatingMicrosoft.TextTemplating.targets" />
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if $(ConfigurationName) == Release (
 "$(ProjectDir)..Build AssistantbinReleaseBuild Assistant.exe" "CleanDir$(ConfigurationName)"
)" />
</Target>
</Project>
对于遇到此问题的任何人,我已经找到了修复方法,或者至少看起来像修复方法。打开任务管理器,重新启动Windows资源管理器。
似乎由于某种原因,它在编译时设置了正确的图标,但Windows资源管理器本身并没有选择它。非常令人沮丧,所以我希望这对遇到同样问题的其他人有所帮助。