dotnet / ResXResourceManager

Manage localization of all ResX-Based resources in one central place.
MIT License
1.29k stars 211 forks source link

feat: convert to sdk style format #595

Closed bdovaz closed 8 months ago

bdovaz commented 8 months ago

When #593 is merged I make the necessary changes to support CPM.

@tom-englert please check that what I have deleted is not needed in the new format. I think it is but I need a review from someone else just in case.

tom-englert commented 8 months ago

I once tried to convert this, but then the "Publish" step no longer generates the "Click Once" application. Did you check that this still works?

tom-englert commented 8 months ago

As you can see in https://dev.azure.com/tom-englert/Open%20Source/_build/results?buildId=6005&view=artifacts&pathAsName=false&type=publishedArtifacts the asset Publish.zip is now missing

bdovaz commented 8 months ago

As you can see in https://dev.azure.com/tom-englert/Open%20Source/_build/results?buildId=6005&view=artifacts&pathAsName=false&type=publishedArtifacts the asset Publish.zip is now missing

Actually the problem you mention is not possible to reproduce in a PR because the task you mention is only executed in the master branch:

https://github.com/dotnet/ResXResourceManager/blob/6c0f8f95f125fd4714f4166a7081457ab8a3752e/azure-pipelines.yml#L54

But it has helped me to make that same check and with some small changes in MSBuild variables, I get it to generate it correctly.

The command that I have used to check it has been: msbuild ResxManager\ResxManager.csproj /target:publish.

So this PR is ready to be merged if you give the go-ahead.

tom-englert commented 8 months ago

The target Publish in an SDK style project does no longer create the click-once app

tom-englert commented 8 months ago

If it would have been that easy, I would have already done it.

bdovaz commented 8 months ago

On publish folder not, but I think because we are not providing a publish profile, because if I create one it correctly generates it:

https://learn.microsoft.com/en-us/visualstudio/deployment/building-dotnet-clickonce-applications-from-the-command-line?view=vs-2022

To test it you need to:

  1. (ResxManager.csproj) change target framework: <TargetFramework>net7.0-windows</TargetFramework>
  2. (ResxManager.csproj) add runtime identifier: <RuntimeIdentifier>win-x86</RuntimeIdentifier>
  3. Create pubxml file (example I'm using, I only changed target framework and runtime):
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <ApplicationRevision>1</ApplicationRevision>
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>True</BootstrapperEnabled>
    <Configuration>Release</Configuration>
    <CreateWebPageOnPublish>False</CreateWebPageOnPublish>
    <GenerateManifests>true</GenerateManifests>
    <Install>True</Install>
    <InstallFrom>Disk</InstallFrom>
    <IsRevisionIncremented>True</IsRevisionIncremented>
    <IsWebBootstrapper>False</IsWebBootstrapper>
    <MapFileExtensions>True</MapFileExtensions>
    <OpenBrowserOnPublish>False</OpenBrowserOnPublish>
    <Platform>Any CPU</Platform>
    <PublishDir>bin\Release\net7.0-windows\win-x86\app.publish\</PublishDir>
    <PublishUrl>bin\publish\</PublishUrl>
    <PublishProtocol>ClickOnce</PublishProtocol>
    <PublishReadyToRun>False</PublishReadyToRun>
    <PublishSingleFile>True</PublishSingleFile>
    <RuntimeIdentifier>win-x86</RuntimeIdentifier>
    <SelfContained>False</SelfContained>
    <SignatureAlgorithm>(none)</SignatureAlgorithm>
    <SignManifests>False</SignManifests>
    <SkipPublishVerification>false</SkipPublishVerification>
    <TargetFramework>net7.0-windows</TargetFramework>
    <UpdateEnabled>False</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateRequired>False</UpdateRequired>
    <WebPageFileName>Publish.html</WebPageFileName>
  </PropertyGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.7.0.x86">
      <Install>true</Install>
      <ProductName>.NET Desktop Runtime 7.0.13 (x86)</ProductName>
    </BootstrapperPackage>
  </ItemGroup>
</Project>
  1. Command:

msbuild ResxManager\ResxManager.csproj /target:publish /p:PublishProfile="ResXManager\Properties\PublishProfiles\ClickOnceProfile.pubxml" /p:PublishDir="PublishTestPath"

tom-englert commented 8 months ago

Most of it is in the project itself, I think <PublishProtocol>ClickOnce</PublishProtocol> is the missing link - I'll give it a try.

tom-englert commented 8 months ago

Yes, that did the trick; thanks for helping to remove this annoying leftover.

tom-englert commented 8 months ago

Superseded by #605