I'm trying to deploy an MVC4 web application to Azure. It has a dependency on an F# project (houses the controllers for the MVC app) which keeps failing to build w/ error:
C:\DWASFiles\Sites\jbf\VirtualDirectory0\site\repository\JBF.Web\JBF.Web.Controllers\JBF.Web.FSharp.fsproj : error MSB4057: The target "Build" does not exist in the project.
The project(s) exist in VS2012 which forces the upgrade of F# projects. I'm wondering if this is a dependency that Azure doesn't support yet with all of the 4.5 refs found in the import statements from the fsproj:
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.5\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.5\Microsoft.FSharp.Targets')" />
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets'))" />
<Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')) And (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets'))" />
For the record if I pre-build the DLL and deploy that (with a reference to the DLL instead of the project) it works just fine. Also, the fsproj has no actual dependency on F# 3.0 (it's an F# 2.0 project migrated to VS2012).
Update: this issue is tracked by https://github.com/projectkudu/kudu/issues/137
I just reproed this. Here is the sample repo: https://github.com/KuduApps/WebAppWithFSharpLibrary.
It's definitely a bug. Could you please open an issue on https://github.com/projectkudu/kudu to track this? It's best to track issue there then as StackOverflow questions. Thanks!
Related
I'm new to creating NuGet packages and have only been playing around with them for a couple of days, as it now stands I've tested my package on .NET Frameworks 3.5 through 4.8 successfully.
By the way, this is the package: https://www.nuget.org/packages/ExcelFromList/1.0.4
My package relies on EPPlus, which is what I use as the engine. If you search for EPPlus you will see that it states that it can be installed on .NET Framework, .NET Standard, and .NET Core, I have tested this and it's correct.
So I'm not sure how to pull this off.
This is the info on my project:
Project is .NET 3.5
Using nuget.exe to create the NuGet package
Using .nuspec file for package creation (nuget pack <.nuspec file>)
Only NuGet package installed in project is EPPLus
This is my .nuspec file:
<?xml version="1.0" encoding="utf-8" ?>
<package>
<metadata>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<id>ExcelFromList</id>
<version>1.0.4</version>
<title>ExcelFromList</title>
<description>Straightforward and easy way to create stylized excel workbooks from lists. Add an image, title, subtitles and overal cell styles/formats. Uses the EPPlus engine.</description>
<releaseNotes>Succesfully tested on .NET frameworks from 3.5 through 4.8</releaseNotes>
<authors>Raul Marquez</authors>
<owners>Raul Marquez</owners>
<copyright>Copyright 2020 Raul Marquez</copyright>
<projectUrl>https://github.com/RaulMarquezInclan/ExcelFromList</projectUrl>
<license type="expression">GPL-3.0-only</license>
<tags>excel list listtoexcel</tags>
<dependencies>
<dependency id="EPPlus" version="5.1.0" />
</dependencies>
</metadata>
<files>
<file src="bin\Debug\net35\ExcelFromList.dll" target="lib\net35" />
<file src="bin\Debug\net35\ExcelFromList.xml" target="lib\net35" />
</files>
</package>
Building the package with that configuration throws me this warning:
WARNING: NU5128: Some target frameworks declared in the dependencies
group of the nuspec and the lib/ref folder do not have exact matches
in the other location. Consult the list of actions below:
- Add a dependency group for .NETFramework3.5 to the nuspec
However, as I stated before, it still installs and runs just fine throughout the different .NET Framework versions.
When attempting to install it on .NET Standard or .NET Core it will install my dll correctly but it won't install EPPlus, which is a dependency of my package. On the .NET Standard side, I only have to manually install it and all is good, on the .NET Core side after doing the same it tells me that the executable cant run in the project.
So, where I'm confused is on how to also make them available to .NET Standard and .NET core, from searching around I've gotten hints about converting it to a .NET standard in the first place, or having three different dlls each corresponding the the different technologies and specifying them in the files section of the .nuspec file, etc.
Can anyone please point me in the right direction?
EDIT: By the way, when looking at the EPPlus package this is what we see:
Thanks.
You can, if you upgrade your .csproj file to the "new" .csproj file format. I'd highly recommend you do that; the new project format is greatly simplified and easier to use.
In this new format, you can target multiple frameworks, like this:
<PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net45;net40;net35</TargetFrameworks>
</PropertyGroup>
The EPPlus project file is a great example of how to do multi-targetting.
You can then build your package by running dotnet pack, and it will automatically create a NuGet package which targets all of the versions of .NET listed in TargetFrameworks.
You will need to use the .NET Core SDK to build your project, but you can still run your package on desktop .NET.
i'm having hard time resolving this new issue.
It appears only on the xamarin.ios project of the solution at compile time.
The xamarin.android project is compiling ok.
I did not reference system.memory but netstandard 2.0 projects.
That was compiling fine until recently.
Is it a known issue in xamarin.ios tooling ? any workaround ?
I've tried:
googling
add the system.memory nuget to the ios project
delete bin/obj/.vs folders, clean/rebuild
I'm dry.
I found the solution here !
Add at the end of your ios project file:
<Target
Name="VS16_RemoveSystemMemory"
BeforeTargets="FindReferenceAssembliesForReferences"
Condition="'$(MSBuildVersion)' >= '16.0'">
<ItemGroup>
<_ReferencePathToRemove
Include="#(ReferencePath)"
Condition="'%(ReferencePath.NuGetPackageId)'=='System.Memory'" />
<ReferencePath Remove="#(_ReferencePathToRemove)" />
</ItemGroup>
<Message Text="Removing System.Memory for VS 2019 compatibility" Importance="high"/>
</Target>
And magically it compiles !
I don't know from where this nuget dependency came, but it's not from my code, it's from a third party nuget, most probably from the Google ones.
For anyone that arrives here on a related issue around Span<T> or ReadOnlySpan<T> being ambiguous in Xamarin iOS with .NET Standard 2.1 dependencies, the issue is still related to System.Memory but the answer pointed out by Softlion did not solve for me. The reasoning and workaround pointed out in this [thread][2] was my underlying problem:
There are two types of the same name System.ReadOnlySpan in the app declared and cannot be unified.
The first one is declared in System.Memory.dll (one implementation)
The second one is in netstandard.dll (the type-forwarder to the second implementation inside mscorlib.dll)
The bug is in System.Memory nuget because it's missing netstandard2.1 TFM implementation where the System.ReadOnlySpan type would not be declared in the assembly but referenced from netstandard.dll
Adding package references for System.Memory 4.5.4 and System.Buffers 4.5.1 was the workaround I needed.
I'm trying to publish a newly created asp.net 4.6 web project to Azure web apps and receiving the following error:
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly D:\home\site\repository\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\home\site\repository\WebApp\WebApp.csproj]
Everything builds fine via Visual Studio 2015 on my local machine. I thought Azure web apps were all set to support VS 2015 RTM upon release, but it would appear they do not have MSBuild 14.0 installed. Is there a work around or a roadmap for this problem?
Here was the fix for me.
Using Nuget Package Manager, remove these two packages if referenced:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers
After that, run a rebuild. This ensured that the build was not trying to use a specific build exe. Click here for the
Diff against previous revision
In my case I have to edit my .csproj file and find below lines and delete them
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
Now everything is fine,
Azure Web Apps doesn't support ASP.NET 4.6 yet. It's on it's way though, so stay tuned.
Out of nowhere I started getting this error when I try to deploy my project to cloud service (using continuous deployment and hosted build controller.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.5\Microsoft.WindowsAzure.targets (2917): Could not load file or assembly 'Microsoft.WindowsAzure.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I found this SO question, but it didn't help me.
Also I noticed I didn't even have folder:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\
I only have v10.0, v11.0, v12.0, so I manually created v14.0 and copied folder Windows Azure Tools form v12.0 but it didn't help.
EDIT
I've updated Azure tools to 2.6 but the problem and error message remains the same.
How can I fix this ?
I had the same error occurring today on Visual Studio Online's Host Build Controller. I assume you are using the same thing by your talk of Azure & Continuous Integration.
I noticed that they just released Azure SDK 2.6 support on the build controller in the last day or so. I feel that this may have somehow caused the problem.
I updated my cloud project to use 2.6, checked in, and everything was fine again. Some ccproj details:
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.6\</CloudExtensionsDir>
</PropertyGroup>
do you updated your Azure SDK for .NET to 2.5.1?
I have experienced this issue before when I updated the Azure SDK for .NET to 2.5.1
Microsoft has just recently release Azure SDK for .NET version 2.6 and I suggest you should try this. I believe this should solve your problem.
"try adding /p:GenerateBuildInfoConfigFile=false to your msbuild arguments in addition to /p:VisualStudioVersion=12.0, that has helped others workaround that same issue."
from here: https://social.msdn.microsoft.com/Forums/en-US/fc434580-cf81-44eb-9382-cd1b9fc9583a/microsoft-azure-sdk-v26-issue-with-cloud-builds?forum=TFService
Update Azure SDK to version 2.6 and after, update your Azure project's Application.
You can do this within the project's properties, by clicking the button to update Microsoft Azure Tools version from 2.5.1 to 2.6.
We have a few projects within our CI environment which have been building successfully. Over the weekend, our IT team installed Azure SDK udpates, and since then, our project to not build anymore (even though they don't reference Azure).
The way we are building projects is
<MSBuild Condition="'$(BuildProject)' != ''" Projects="#(Projects)"
Properties="Platform=$(Platform);Configuration=$(Configuration);OutDir=$(TempProjectFilesPublish)\bin\;WebProjectOutputDir=$(TempProjectFilesPublish)"
Targets="Build"
ContinueOnError="false">
where #(Projects) is a reference to the Solution folder.
<Projects Include="$(BuildProject)"/>
The issue is around resolving project references. Nothing has changed over the weekend. The project references are correct, the csproj file has the appropriate values, no new projects or code changes have been made which is leading me to think something has been disrupted.
Wondering if anyone might know of any changes to MSBuild that would affect this?
This issue ended up being a bug in Azure SDK 2.3 with a conflict to Newtonsoft.JSON dll.
The SDK installs a 4.5 build version into the GAC, which is overriding any Newtonsoft references in projects to 4.0.
https://connect.microsoft.com/VisualStudio/feedback/details/850425/windows-azure-vs-tools-breaking-msbuild-for-web-projects
Microsoft have stated this will be fixed in 2.4.
I experience the same problem with Azure SDK v2.9. I've fixed the build for the moment by uninstalling "Microsoft Azure Library for .NET v2.9".
P.S.: Unfortunately, the link provided in the answer by mickyjtwin no longer works.
P.P.S.: The following question seems to be related:
Visual Studio keeps overwriting NewtonSoft.Json.DLL with an older version