valadas / Eraware_Dnn_Templates

Dnn templates
Other
19 stars 7 forks source link

New Version 1.2 Not finding MSBuild #441

Closed tharris9d closed 2 years ago

tharris9d commented 2 years ago

image

No errors until hitting the target compile... I will hard code the path again for now. Same issue with Target UnitTests and Target IntegrationTests Added: .SetProcessToolPath(@"D:\Program Files\Microsoft Visual Studio\2022\Community\MSbuild\Current\Bin\msbuild.exe") to all three. It is all working with the change.

valadas commented 2 years ago

@matkoch I thought this was fixed in 6.0.1 or is it queued up for upcoming 6.0.2 ?

matkoch commented 2 years ago

What does EnvironmentInfo.SpecialFolder(SpecialFolders.ProgramFiles) return?

valadas commented 2 years ago

For me (I am not experiencing the reported issue), it returns C:\Program Files

@tharris9d I did this test by adding this to any target and putting a breakpoint to look at the output at that stage:

        Serilog.Log.Information(EnvironmentInfo.SpecialFolder(SpecialFolders.ProgramFiles));

Let us know if you get something odd on your side with this...

tharris9d commented 2 years ago

As soon as I get back to my computer I will check it out.

tharris9d commented 2 years ago

I get "C:\Program Files". I have VS Community 2022 installed on D:\Program Files. Could that be the issue?

matkoch commented 2 years ago

That's definitely the issue. You could rely on VSWhere instead which takes a different approach on resolving the installation directory. Nothing pre-existing though.

valadas commented 2 years ago

Yeah, this is a bit of an edge case here as I believe there is no nice way in Windows to have software installed at multiple Program Files locations and the %PROGRAMFILES% environment variable is probably not setup to know about the d: location.

I tried to use VsWhere a bit to try and implement a solution that would cover this use case, but after about an hour I was not able to figure out how it's supposed to be used. I'll close this issue but if some idea come up to make this work in another way than to hardcode the path, please do submit a PR and I'll be glad to make it part of the template.