-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
NetCore: Error on Solution Rebuild in Visual Studio 2022 #10760
Comments
I think it would be best to use our templates to set up a project, open the csproj in VS and when saving it put the solution file somewhere (it will ask you where to put it). Like in v8, we advise you not to use the default MVC template, in v9, we advise you to use the Umbraco template. We are aware that the template doesn't get installed in VS2022 Preview for now so we recommend setting your solutions up in VS2019 stable :) As it turns out, with your setup in your <PropertyGroup>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
</PropertyGroup> Whereas the default if you use the .NET template would be: <PropertyGroup>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>
</PropertyGroup> There's no need to compile razor, which is probably why there's too much being compiled. However, correcting this has led to another error on rebuild:
Mostly, I would ask why the need to rebuild at all, a rebuild is hardly ever necessary. I know a lot of people are used to doing it for unknown reasons but a regular build is enough 99,999999% of the time. That is a scientific number, yes! 😉 Anyway, a build after a rebuild with the I'm sure it SHOULD be possible to compile razor files as well and it would be great to investigate how to fix the original error reported as well. |
Hi @idseefeld, We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know. For more information about issues and states, have a look at this blog post Thanks muchly, from your friendly Umbraco GitHub bot :-) |
@nul800sebastiaan interestingly the following solved the issue:
Uups, actually I should have known about the extra line, as I have reported the publish issue. Razor build in this case might be okay(?), because my configuration for ModelsBuilder extracts the models into a folder of the .Core project (see appSettings.Development.json):
My understanding here is, that this is the best way to avoid circular dependencies. Btw. I did not use VS2022 to create the solution. I have just opened it later on and tried out building times, which probably was the reason for finding the issue😜 (I know you have written about the Rebuild topic in 24days or so and I agree although I am not aware of the exact difference between the combination of Clear & Build vs Rebuild🤔) Nevertheless there must be differences in the behaviour of VS2019 vs VS2022 as my example clearly shows. So from my point of view their comment is wrong. 🙄 Finally I close the issue! |
@nul800sebastiaan Sorry, I have reopen this again.
Maybe I have used VS2019 and not VS2022 as the Rebuild seems to work🤪 Would be nice if someone could verify with the previous VS2022... Or we take your advice for now and do not use Rebuild. In the end VS2022 is still in preview🙄 |
Just found another hint: |
We clean up files on clean, and add files (if missing) on build. This all happens in the targets file from the nuget package: https://github.com/umbraco/Umbraco-CMS/blob/v9/dev/build/NuSpecs/build/Umbraco.Cms.StaticAssets.targets |
Just to chime into this, I am using the razor compile on build & publish, I've also found odd behaviour at one point if you have one on & not the other, but my models are in a separate compiled destination hence my use of it. Not to mention if this is not enabled, then the site can break when deployed due to Umbraco generating its own files & then there being ambiguous references etc. Also I find that Umbraco is quite a lot faster when the razor files are compiled into the solution, presumably because they are not being re-compiled when the site starts up anymore etc. Just watch out that you have both set to true, otherwise Umbraco itself gets upset and starts breaking at times as well (when using dotnet publish) which I now have a setup whereby I am deploying a whole Umbraco site just by using dotnet publish on & pushing it to a build server which then deploys the output zip to a folder & it works without a hitch now. |
Just looking at the source this looks like Clean/Rebuild would wipe out ALL assets in the umbraco folders. E.g. if I have a custom language file in umbraco\config\lang it would also be removed. Is this intentional? |
@bachratyg Yes, the files in You can put custom language files in And example of overriding an existing language can be found here: #11345 (comment) And if you have your own language file. let's say for Ukranian, I believe you would start a new file |
I just realized that this specific issue has been fixed in #11216 for the 9.0.1 release tomorrow, I'll close this one as fixed! |
Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8
v9-RC
Bug summary
What I did
I am testing Visual Studio 2022 Community Preview edition and have a solution with a .Net 5 MVC Website project depending on a class library project.
Command combination of Clean and Build solution works.
Using just Rebuild fails with:
You may clone repo https://github.com/idseefeld/Umbraco9ModelsBuilderSample to reproduce the issue.
The issue might be related to this solutions specifics, but in Visual Studio 2019 Community edition Rebuild works.
Microsoft response
This issue seems to be caused by Umbraco (particularly the Umbraco.StaticAssets package) are built and not Visual Studio or the .NET Core SDK. We recommend filing an issue at their project site: https://github.com/umbraco/Umbraco-CMS. For more information, see also our issue reporting guidelines.
🙄Any idea?
Kind regards,
Dirk
Specifics
Please find Microsoft issue report here: https://developercommunity.visualstudio.com/t/error-on-solution-rebuild-in-visual-studio-2022/1477291
Steps to reproduce
Expected result / actual result
In Visual Studio 2019 Community edition Rebuild Solution works.
The text was updated successfully, but these errors were encountered: