Specify multiple MsBuild for one Solution?

We have one Solution which contains classic Framework 4.8 asp.net WebForms Projects alongside .netstandard2.0 and AspNetCore dotnet5.0 WebProjects. We are using MsBuild 16 from a Visual Studio Installation to Build this Solution.

Now we want to upgrade the dotnet5.0 Projects to dotnet6.0. But MsBuild 16 can not build the new dotnet6.0 projects. On the other hand MsBuild 17 can not build the classic Framwork 4.8 Projects.

I thougt about splitting the Projects into two solutions, but I would rather keep them in one single solution. Does anyone have any ideas how to solve this?

Thanks,

Thomas

0
8 comments

Hi Thomas Schreiner

We've checked the scenario you described, and in general, Rider should build it fine. Can you share your project, or details, along with .csproj-es and .sln, for the investigation? Please also share the Build error and a screenshot of your File | Settings | Build, Execution, Deployment | Toolset and Build.

Thank you in advance! 

0
This solution demonstrates that MsBuild 17 can not build .net Framework 4.8 
projects which reqire a licenses.licx file.

The Error Message we get:

`Microsoft.Common.CurrentVersion.targets(3374, 5): [MSB4803] Die Aufgabe "LC" wird für die .NET Core-Version von MSBuild nicht unterstützt.
Verwenden Sie die .NET Framework-Version von MSBuild. Weitere Informationen finden Sie unter https://aka.ms/msbuild/MSB4803.`

We want to migrate some of our projects to dotnet 6 or 7, but still need to be
able to build old Framework 4.8 projects together in the same solution.
Moving those projects into separate solutions is not an option for us since there
is shared code between those projects and we would lose immediate compiler feedback if
we broke something in the other solution.

Is there a way in rider to specify msbuild versions per project instead of per solution,
or do you have any other idea on how to solve this?

Code:
https://github.com/qualifood/WebProjects.git

Thanks for looking into this.

0

Alexandra Guk did you find time to look into this?

0

Hi,

When MSBuild builds a solution, all of the project are running on the same engine. Rider cannot affect this anyhow. Actually, MSBuild 17 should build both Framework and Core projects.
It seems that we miss important details. Could you please create a support request for that and attach your csproj files? Or one can share these files via uploads.jetbrains.com service and let me know the exact uploadsID.

In a simple scenario it just works if I create .NET Framework 4.8 alongside .NET Core project.  

K.R.

Sofia

0

Hi Sofia Byzova

Thanks for your answer. I already created a sample project here: https://rider-support.jetbrains.com/hc/en-us/community/posts/10142870447890/comments/10613066824850

Our Solution contains assemblies which reqire licensing, but the lc.exe is no longer supported by msbuild 17.

Thanks again,

Thomas

1

Hi,

Thank you, I will take a look. Did not notice the link.

0

Now I can see the full picture. Thank you for the sample solution. As you mentioned above, lc.exe is not supported by .NET SDK (just for a reference: https://developercommunity.visualstudio.com/t/dotnet-build-fails-to-invoke-license-utility-lcexe/27335).

Unfortunately, there is no way to hack Rider anyhow to make it use different MSBuild engines for projects in one solution. 

But, one can:
- create a separate solution (as you mentioned),
- or precompile your licx files into resources once with lc.exe and include the result in your project. If you only rarely update the licensed resource, that would be the easiest.
- or add licx support to your project in dotnet build. It's not an all-or-nothing case with msbuild actually, it's extensible on feature-by-feature basis, you just have to handle the task item transformation from licx into resources, by calling lc.exe from somewhere (preferrably an <Sdk/> nuget package, but actually anything including a network share). Not a fun journey with msbuild though.

 

0

Sofia Byzova

I finally found the time to implement precompiling the licx as you suggested and it worked! Thank you so much!

At first emgedding the genereted .dll.licneses file did not work. After investigating resource names from old and new assemblies with dotPeek I realized that I misnamed the generated licenses file. Make sure to name the precompiled licenses file: `dll.licenses` and put it in the root of the project as an embedded resource. Otherwise it won't be found. During the embedding process the projects default namespace is prepended to the filename.

Thanks again,

Thomas

1

Please sign in to leave a comment.