Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bypass warnings when targeting .Net 4.5.2 during publish

My Azure services target .Net 4.5.2 and run fine in dev. However, build produces the warning(s):

Warning The project 'SurfInfoWeb' targets .NET Framework 4.5.2. To make sure that the role starts, this version of the .NET Framework must be installed on the virtual machine for this role. You can use a startup task to install the required version, if it is not already installed as part of the Microsoft Azure guest OS.

I believe these (local) warnings are causing the publish to fail immediately (and these are the ONLY warnings in the error list).

According to MS, 4.5.2 is supposed to be available in January 2016 (I'm not sure exactly what date, but I thought I had read Jan 12 or Jan 16).

I can't suppress these warnings in the normal way because they don't have warning codes.

1) Is .Net 4.5.2 actually available on Azure

2) Is there a way to suppress warnings that don't have codes?

3) Something else I'm not thinking of?

I'm using SDK 2.8.1. And OSVersion="*".

like image 409
Bill O Avatar asked Jan 19 '16 16:01

Bill O


2 Answers

Is .Net 4.5.2 actually available on Azure?

Yes. .NET 4.5.2 is available in the current osVersion * of osFamily 2, 3 and 4.

Is there a way to suppress warnings that don't have codes?

Cloud service projects upgraded to Azure SDK 2.9 no longer generate this warning. Projects using a prior version of the SDK (even if version 2.9 is installed) still generate this warning. To suppress this warning without upgrading the project to SDK 2.9 you can add the following snippet to your .ccproj file.

<ItemGroup> <WindowsAzureFrameworkMoniker Include=".NETFramework,Version=v4.5.2" /> </ItemGroup>

like image 127
Oleg Sych Avatar answered Nov 07 '22 20:11

Oleg Sych


Based on the comments provided here - https://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-install-dotnet/, there's no way to suppress this warning.

enter image description here

Is .Net 4.5.2 actually available on Azure?

As of today, yes. .Net 4.5.2 is available on Azure. In fact, we ported our solution from .Net 4.5 to .Net 4.5.2 just a few days ago.

In order to make use of .Net 4.5.2, you can't use "*" for osVersion. You would need to target a specific OS version. Please see the Guest OS/Target Framework version matrix here: https://azure.microsoft.com/en-in/documentation/articles/cloud-services-guestos-update-matrix/.

Our solution makes use of osFamily 4 and based on this matrix, we ended up using WA-GUEST-OS-4.26_201511-02 osVersion. Here's how our service configuration file looks like:

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="ServiceName" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="WA-GUEST-OS-4.26_201511-02" schemaVersion="2015-04.2.6">
  <Role name="RoleName">
  </Role>
</ServiceConfiguration>
like image 43
Gaurav Mantri Avatar answered Nov 07 '22 18:11

Gaurav Mantri