Docker errors when trying to publish ASP.NET project - c#

I have an ASP.NET project (NET6) and I removed Docker support by:
Deleting the 'targets' file
Deleting the 'docker' file
Removing 'Docker' settings from the 'launchsettings.json' file
When I try to publish the project I get the following errors:
Visual Studio container tools require Docker Desktop. To get it, see https://go.microsoft.com/fwlink/?linkid=847268
The "KillAppInsideContainer" task failed unexpectedly.
I've installed Docker Desktop for Windows and I still get these errors when publishing:
The "KillAppInsideContainer" task failed unexpectedly.
Method not found: 'Void Microsoft.VisualStudio.Containers.Tools.Shared.Functions.AzureFunctionsFeedDataProvider..ctor(Microsoft.VisualStudio.Containers.Tools.Common.Services.Logging.ILoggingService)'.
Am I missing other settings / places where Docker is still referenced?

I had a reference to this Nuget package:
Microsoft.VisualStudio.Azure.Containers.Tools.Targets
Once removed, publishing works fine.

Related

c# cross build different glue to native code for mac, windows in single nuget package inside docker linux image

I am trying to build bindings to C library. Api(sizes of types mostly) different for each operation system. I want to put #if MACOS or whatever macros in code to isolate differences.
I tried to add very specific target frameworks like this <TargetFrameworks>net6.0-macos12;net6.0-windows7</TargetFrameworks>, seems like this is what I want.
In docker image I executed dotnet workflow restore and some macos things installed, but later when I run dotnet pack or dotnet build, command failed with
/usr/share/dotnet/packs/Microsoft.macOS.Sdk/13.0.784/tools/msbuild/macOS/Xamarin.Shared.targets(1400,3): error MSB4018: The "FindItemWithLogicalName" task failed unexpectedly. [/project/MyProject/MyProject.csproj]
/usr/share/dotnet/packs/Microsoft.macOS.Sdk/13.0.784/tools/msbuild/macOS/Xamarin.Shared.targets(1400,3): error MSB4018: System.DllNotFoundException: Unable to load shared library '/usr/lib/libc.dylib' or one of its dependencies. In order to help di
agnose loading problems, consider setting the LD_DEBUG environment variable: /usr/lib/libc.dylib: cannot open shared object file: No such file or directory [/project/MyProject/MyProject.csproj]
/usr/share/dotnet/packs/Microsoft.macOS.Sdk/13.0.784/tools/msbuild/macOS/Xamarin.Shared.targets(1400,3): error MSB4018: at Xamarin.Utils.PathUtils.realpath(String path, IntPtr buffer) [/project/MyProject/MyProject.csproj]
Question is - how I can build such packages in docker container?

"dotnet build" command fails with error MSB6006: "csc.exe" exited with code 1

I'm trying to get a Xamarin Forms solution to build from the command line as part of a build script using the command dotnet build <solution.sln>. Most of the projects in the solution build; however, two projects fail with this error message: error MSB6006: "csc.exe" exited with code 1.(on Ubuntu) and error MSB6006: "csc.exe" exited with code 8. (on Mac).
I have running Ubuntu 18.04 (using Windows subsystem for Linux) and MacOS 10.13.6 on separate machines.
I have also tried to run dotnet build <solution.sln> from the windows command line which prints out this error message instead:
error MSB4062: The "XamarinLive.Build.XamarinLiveTask" task could not be loaded from the assembly C:\Users\Jason.nuget\packages\livexaml\2.1.22\build\XamarinLive.Build.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 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.
However, the solution works and builds fine from within VS2017 (Version 15.9.7). I've tried scouring the binary log that is generated but I can't make much sense of it and there doesn't seem to be any obvious errors (on Ubuntu & Mac). Could the windows error message be related in some way?
The projects that are failing target netstandard 2.0 (The same as the projects that do build). The version returned by dotnet --version on all 3 environments is 2.1.504.
Any help would be greatly appreciated.
You need to use msbuild.exe instead of dotnet
build
for this situation.
msbuild.exe runs on full framework while dotnet buildruns on .NET Core, and most of the build tasks don't support that.
When you build them in VS,it actually calls the msbuild.exe to build the solution.So you can build it well by developer command prompt since it also calls the msbuild.exe.
For vs2017, you can find it in C:\Program Files (x86)\Microsoft Visual Studio\2017\Edition\MSBuild\15.0\Bin.
More details see Martin's answer from this similar issue. Thanks to his detailed description!

Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference

When trying to use .net core 2.1 rc1 to add a service reference for WCF, I am experiencing the following error:
Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference
I have checked and the only security in place is Transport, no message security.
The logs are as follows:
[05/24/2018 12:28:28],59,Importing web service metadata ...
[05/24/2018 12:28:28],27,Number of service endpoints found: 2
[05/24/2018 12:28:28],9,Scaffolding service reference code ...
[05/24/2018 12:28:28],71,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet new console --no-restore --force --type project --language C# --output . --name svcutil_starter"
[05/24/2018 12:28:30],9,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet restore --ignore-failed-sources"
[05/24/2018 12:28:31],35,Executing command [C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\svcutil_starter]
"dotnet "svcutil" --additionalprobingpath "C:\Users\me\\.nuget\packages" "C:\Users\me\AppData\Local\Temp\WCFConnectedService\2018_May_24_12_28_28\SvcUtilParams.txt""
[05/24/2018 12:28:32],52,An unknown error occurred while invoking the service metadata component.
Failed to generate service reference.
[05/24/2018 12:28:32],11,Done.
As a temporary solution to this issue I have added a new Project to my solution, set it to Asp Core 1.1 and added the connected service that way which appears to work.
It would seem 2.1 is broken currently and I'll have to wait for updates before doing it directly in my Project.
Edit: Thanks to User3130628. This has now been fixed and appears to be working, even in VS 15.7.5.
I suspect the Core framework has been updated and this has corrected the issue.
Till 2018-07-31, it still has problems for NET Core 2.1.x to add a service reference for WCF in VS2017 (v15.7.5). You can create Net 2.0.x project to create the connected service, it'll work perfect. Then copy the 'Connected Services' sub-directory in project to new NET core v2.1.x project.
Installs the following packages via NuGet such as this image:
NuGet Packages for Connected Services
Compiled successfully in NET Core 2.1.x project.
As of today VS2017 15.8.1 it seems to be working again with .Net core 2.1.401
Not sure why this worked for me:
Created second Temp new project targeted to .Net Core 2.0 (in another instance of VS)
Make service reference call (Microsoft WCF Web Service Reference Provider) with .wsdl uri
Open 1st project (target project targetted to .Net Core 2.1) and add the service reference the same way.
Not sure why this worked. Without creating the second solution in a different instance of Visual Studio, it was not working.
Hope this helps.

Error : ts-loader: Using typescript#1.8.10 azure deployment

I'm using aspnetcore template , with React + Redux and webpack, when im using publish
Severity Code Description Project File Line Suppression State
Error ts-loader: Using typescript#1.8.10 and
C:\Users\nomorethrow\Documents\Visual Studio
2015\Projects\EPWeb\tsconfig.json EPWeb 0
i dont know how to resolve this, in node.js all works well (dotnet run etc), but in visual studio i get error
I remove 2 line in project.json. It can deploy
"node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
"node node_modules/webpack/bin/webpack.js"
But I have another error when access the deploy version: "Win32Exception: The system cannot find the file specified StartCore" I don't know it have relation or not (Cannot run asp.net core, angular 2, server side rendering project in server)
Ok, I don't know why publish treats this information as error and fails but for me the solution was to set silent mode in ts-loader webpack configuration.

Error deploying to AWS through visual studio

My co-worker is able to deploy our projects to AWS Elastic beanstalk fine. However I have issues on both my work machine and my home laptop. Both computers have the same error in AWS window pane.
I get a pop up as follows:
Deployment of the website failed due to errors during build of the deployment archive,
check visual studio output window 'Build' and/ or 'Amazon Web Service' panes for more details.
Then in the amazon window pane I get a different error everytime I try to run the deployment.
Example 1:
...package build 'CopyPipelineFiles': error in 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets' at (1413,5): Copying file Web.config to obj\AmazonDev\TransformWebConfig\original\Web.config failed. Could not find file 'Web.config'.
Example 2:
...package build 'TransformXml': error in 'C:\Users\Andrew\colony\colony-website\Colony.Web\Colony.Web.csproj' at (840,5): Could not open Transform file: Could not find file 'C:\Users\Andrew\colony\colony-website\Colony.Model\Web.AmazonDev.config'.
Seems to be a different error each time -- I'm not sure how to even begin to look for any issues.
Jim Flangagan's comment is the answer: ReSharper 8.2 is causing this problem. To resolve either disable resharper ( Tools>Options>ReSharper>General>Suspend Now) or upgrade Resharper.

Categories

Resources