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

Azure Web App deployment fails to build class library project that uses string interpolation #1659

Closed
jonsagara opened this issue Aug 17, 2015 · 10 comments

Comments

@jonsagara
Copy link

@jonsagara jonsagara commented Aug 17, 2015

I have an Azure Web App deployed via git that uses the new C# 6 interpolation feature, but the deployment fails. The actual code using string interpolation resides in a class library project, not the web project.

Using https://github.com/KuduApps/Dev14_Net46_Mvc5, I verified that string interpolation code in the web project does not cause a build failure, and it deploys and runs correctly as an Azure Web App.

I forked the above repo - see the "commonproj" branch in https://github.com/jonsagara/Dev14_Net46_Mvc5. I then created a class library project and referenced it from the web project. I moved the string interpolation code into the class library project in a file named CultureHelper.cs. When I try to deploy this as an Azure Web App via git, I get the following error:

CultureHelper.cs(19,20): error CS1056: Unexpected character '$' [D:\home\site\repository\Dev14_Net46_Mvc5.Common\Dev14_Net46_Mvc5.Common.csproj]

Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\Dev14_Net46_Mvc5\Dev14_Net46_Mvc5.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\f8ad415b-73f5-4460-8aea-9a9643c0590f";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository\.\\"

An error has occurred during web site deployment.

As requested by David Ebbo, I am filing this issue here. Please let me know if you need more information.

Thank you,

Jon

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Aug 17, 2015

Relates to #1405.

Seems the reason is that it ends up using D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe, while the one that works is D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe. I don't understand why the one in the Framework folder is old, though I see the same on my local machine.

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Aug 17, 2015

For now, please try the following simple workaround: in the Azure portal, add the following MSBUILD_PATH App Setting:

MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe

We will work on making things work out of the box, but this should get you going!

@jonsagara
Copy link
Author

@jonsagara jonsagara commented Aug 17, 2015

Confirmed that the workaround works. Thanks!

@mxmissile
Copy link

@mxmissile mxmissile commented Aug 17, 2015

Confirmed workaround works also.

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Aug 17, 2015

@mxmissile yep, Portal App Setting, not web.config :)

The fix should be in soon, and this will no longer be required.

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Aug 18, 2015

Keeping active until we get to deploy. From initial tests, switching to the new msbuild is not completely harmless and could break other scenarios, so we need to do this carefully :)

@davidebbo davidebbo reopened this Aug 18, 2015
@regisbsb
Copy link
Contributor

@regisbsb regisbsb commented Aug 18, 2015

@davidebbo so it's not deployed yet? I've tried to delete the /site/deployments/tools/* contents of my website but the new script still generates SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe on line 61 instead of the vs 2015 version...
#1629

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Aug 18, 2015

@regisbsb no, it won't happen right away as we need to be careful. Just use the workaround above. It's painless and should completely address the issue until we get to deploy this fix.

@regisbsb
Copy link
Contributor

@regisbsb regisbsb commented Aug 18, 2015

@davidebbo
Copy link
Member

@davidebbo davidebbo commented Sep 16, 2015

This is now deployed, and the new msbuild is used by default.

@davidebbo davidebbo closed this Sep 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants