Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umbraco/config/lang missing on dotnet publish --no-build #11662

Closed
p-m-j opened this issue Nov 18, 2021 · 5 comments
Closed

umbraco/config/lang missing on dotnet publish --no-build #11662

p-m-j opened this issue Nov 18, 2021 · 5 comments

Comments

@p-m-j
Copy link
Contributor

p-m-j commented Nov 18, 2021

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

9.1.0

Bug summary

See title.

Workaround

don't --no-build when publishing, you can even skip the dotnet build step and just dotnet publish as long as --no-build is not present (9.1.0+)

Specifics

No response

Steps to reproduce

Create a new umbraco 9.1.0 project

$ dotnet new umbraco --name repro
$ cd ./repro
$ dotnet build
$ dotnet publish -o dist --no-build --no-restore
$ ls ./dist/umbraco/config
# no lang dir

Expected result / actual result

lang dir created and populated


This item has been added to our backlog AB#15174

@p-m-j p-m-j added the type/bug label Nov 18, 2021
@p-m-j
Copy link
Contributor Author

p-m-j commented Nov 18, 2021

GetCopyToOutputDirectoryItems doesn't run when publish --no-build and therefore IncludeUmbracoFolderContent doesn't run.

See https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets

@p-m-j p-m-j added the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Nov 18, 2021
@sitereactor
Copy link
Contributor

FWIW the csproj for 9.0.0 and 9.01 looked like this

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <TargetFramework>net5.0</TargetFramework>
        <DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins/**;</DefaultItemExcludes>
        <DefaultItemExcludes>$(DefaultItemExcludes);umbraco/**;</DefaultItemExcludes>
        <DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/media/**;</DefaultItemExcludes>
    </PropertyGroup>

    <!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
    <ItemGroup Condition="'$(OS)' == 'Windows_NT'">
        <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.6" />
        <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Umbraco.Cloud.Identity.Cms" Version="4.0.50" />
        <PackageReference Include="Umbraco.Cloud.StorageProviders.AzureBlob" Version="4.0.0" />
        <PackageReference Include="Umbraco.Cms" Version="9.1.0" />
        <PackageReference Include="Umbraco.Deploy.Cloud" Version="9.1.0" />
        <PackageReference Include="Umbraco.Deploy.Contrib" Version="9.0.0" />
        <PackageReference Include="Umbraco.Deploy.Forms" Version="9.1.0" />
        <PackageReference Include="Umbraco.Forms" Version="9.1.0" />
    </ItemGroup>

    <ItemGroup>
        <Content Include="App_Plugins/**" CopyToOutputDirectory="Always" />
        <Content Include="umbraco/**" CopyToOutputDirectory="Always" />
        <Content Remove="umbraco/Data/**" />
        <Content Remove="umbraco/Logs/**" />
        <Content Remove="umbraco/mediacache/**" />
        <Content Remove="umbraco/models/**" />
        <Compile Include="umbraco/models/**" Exclude="**/*.flag" />
    </ItemGroup>

    <PropertyGroup>
        <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
    </PropertyGroup>

    <!-- Set this to true if ModelsBuilder mode is not InMemoryAuto-->
    <PropertyGroup>
        <RazorCompileOnBuild>false</RazorCompileOnBuild>
        <RazorCompileOnPublish>false</RazorCompileOnPublish>
    </PropertyGroup>
</Project>

whereas in 9.1.0 it looks like this (when using the dotnet new template):

<Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup>
        <TargetFramework>net5.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Umbraco.Cloud.Identity.Cms" Version="4.0.50" />
        <PackageReference Include="Umbraco.Cloud.StorageProviders.AzureBlob" Version="4.0.0" />
        <PackageReference Include="Umbraco.Cms" Version="9.1.0" />
        <PackageReference Include="Umbraco.Deploy.Cloud" Version="9.1.0" />
        <PackageReference Include="Umbraco.Deploy.Contrib" Version="9.0.0" />
        <PackageReference Include="Umbraco.Deploy.Forms" Version="9.1.0" />
        <PackageReference Include="Umbraco.Forms" Version="9.1.0" />
    </ItemGroup>

    <!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
    <ItemGroup Condition="'$(OS)' == 'Windows_NT'">
        <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
        <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2" />
    </ItemGroup>

    <PropertyGroup>
        <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
    </PropertyGroup>

    <!-- Set this to true if ModelsBuilder mode is not InMemoryAuto-->
    <PropertyGroup>
        <RazorCompileOnBuild>false</RazorCompileOnBuild>
        <RazorCompileOnPublish>false</RazorCompileOnPublish>
    </PropertyGroup>
</Project>

I know that you mentioned that these should not be necessary anymore, but if I add them back in, in a 9.1.0 project (both the items under the PropertyGroup at the top and the ItemGroup) then it works as expected on Umbraco Cloud.

@p-m-j
Copy link
Contributor Author

p-m-j commented Nov 19, 2021

Yep that's how it used to work, it may be that adding to the content item is the fix but should be applied in targets files instead of polluting the csproj, however that will cause us issues with duplicates for those upgrading from 9.0.0 (as their csproj will also add to content item).

Will come up with something.

@sitereactor
Copy link
Contributor

But if I add those elements back in I don't get 'duplicate property' errors. Just tested it on two different 9.1.0 projects.

@p-m-j
Copy link
Contributor Author

p-m-j commented Nov 19, 2021

If you content include in csproj (e.g. those upgrading from 9.0.0), and we add in static assets.targets for 9.1.1 you would get errors, came up in the iterations that led us to where we are now.

Some history here #11211

bergmania pushed a commit that referenced this issue Nov 22, 2021
* Ensure Umbraco static assets included when publish --no-build

Closes #11662

* Bump version to 9.1.1
@umbrabot umbrabot removed the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants