I'm trying to deploy aspnetboilerplate with Azure DevOps Pipelines. I'm using the basic dotnet build -c release command, but always get:
"d:\a\1\s\aspnet-core\src\Myapp.Web.Mvc\Myapp.Web.Mvc.csproj" (Build target) (1:7) ->
"d:\a\1\s\aspnet-core\src\Myapp.Web.Core\Myapp.Web.Core.csproj" (default target) (2:6) ->
"d:\a\1\s\aspnet-core\src\Myapp.EntityFrameworkCore\Myapp.EntityFrameworkCore.csproj" (default target) (5:7) ->
(CoreCompile target) ->
C:\Program Files\dotnet\sdk\2.2.105\Roslyn\Microsoft.CSharp.Core.targets(52,5): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\2.2.105\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Assembly with same name is already loaded Confirm that the <UsingTask> 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:\a\1\s\aspnet-core\src\Myapp.EntityFrameworkCore\Myapp.EntityFrameworkCore.csproj]
Any ideas please?
you can use publish command. go to the solution root directory and run
dotnet publish -c release -o C:\myproject
Related
So I'm trying to automate the builds for a Xamarin project and integrate it to our company's CI pipeline. I'm not really familiar with .NET/Xamarin building process, but I've done it before following the really short guide for CI they have.
I'm using a standalone macOS build server (since we have to build iOS .ipa with XCode) with Visual Studio for this purpose.
Turns out, this time, we have a local dependency (some library we needed to slightly modify) integrated as a git-submodule on the project. The developers are all using the IDE for this and it loads/unloads and resolves all the dependencies without problem (or at least they told me that): they just have to hit the "play" button and it simply builds everything.
I'm trying to find a way to the same programmatically (using msbuild on the CI server) and here's where the problems start: so far, every time I run
$ nuget restore projectApp.sln
[...] # first get the project packages
$ msbuild \
/p:Configuration="Debug" \
/p:Platform="iPhone" \
/p:BuildIpa=true \
/p:IpaPackageDir="./Builds" \
/t:Build project.sln
... I get ~250 "are you missing an assembly reference?" errors. I assumed that meant the library dependencies were not found, so I tried resolving them with nuget:
$ nuget restore TK.CustomMap/TK.CustomMap.sln
[...]
But running msbuild again returns the exact same output:
[...]
Project "/Users/builder/project/projectApp.sln" (1) is building "/Users/builder/project/projectApp/projectApp.csproj" (2) on node 1 (default targets).
Project "/Users/builder/project/projectApp/projectApp.csproj" (2) is building "/Users/builder/project/TK.CustomMap/TK.CustomMap/TK.CustomMap/TK.CustomMap.csproj" (3:2) on node 1 (default targets).
CoreCompile:
[...]
"/Users/builder/project/projectApp.sln" (Build target) (1) ->
"/Users/builder/project/projectApp/projectApp.csproj" (default target) (2) ->
"/Users/builder/project/TK.CustomMap/TK.CustomMap/TK.CustomMap/TK.CustomMap.csproj" (default target) (3:2) ->
(CoreCompile target) ->
Api/Google/GmsDirection/GmsDirection.cs(2,18): error CS0234: The type or namespace name 'Http' does not exist in the namespace 'System.Net' (are you missing an assembly reference?) [/Users/builder/project/TK.CustomMap/TK.CustomMap/TK.CustomMap/TK.CustomMap.csproj]
Api/Google/GmsDirection/GmsDirection.cs(5,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [/Users/builder/project/TK.CustomMap/TK.CustomMap/TK.CustomMap/TK.CustomMap.csproj]
First of all, I want to know if there's a way to build the library fork on a different, internal pipeline and serve it + handle it in the project using nuget (like I'd do with the original version).
And then, in case that is too much over-engineering, how to properly build locally the whole project (including the library) and link it all together.
I have an ASP.NET Core app which I can publish using web deploy and pre-configured publishing profile via Visual Studio 2017. Now I need to configure CI and trying to achieve the same from the command line so I installed [.NET Core SDK][1] and followed this guide
dotnet build -c release /p:DeployOnBuild=true /p:PublishProfile=publish-profile-name
Unfortunately, it gives the following error:
C:\Program
Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk.Publish\build\netstanda
rd1.0\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(227,5):
error MSB4062: The "CreateManifestFile" task could not be loaded from
the assembly C:\Program
Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0
....\tools\netcoreapp1.0\Microsoft.NETCore.Sdk.Publish.Tasks.dll.
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.
How can I fix the dotnet build line?
If your publish profile uses MSDeploy, it cannot be built via the .NET Core based build tools (dotnet build).
See the related GitHub issue https://github.com/aspnet/websdk/issues/166
The workaround is to use msbuild /p:Configuration=Release … from a VS 2017 installation instead of dotnet build.
Has anyone managed to build Xamarin Android apps with VS2017 MSBuild and Jenkins?
On our build machine we can build via the command prompt but when building via Jenkins we get this error.
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2371,2):
error MSB4062: The "Xamarin.Android.Tasks.GetAndroidPackageName" task
could not be loaded from the assembly C:\Program Files (x86)\Microsoft
Visual
Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll.
Method 'get_BuildEngine' in type 'Xamarin.Android.Tasks.AsyncTask'
from assembly 'Xamarin.Android.Build.Tasks, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' does not have an implementation.
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
We're using a Pipeline script with the following command. The same command works fine with VS2015 MSBuild and Jenkins.
bat "${msbuild15} /consoleloggerparameters:ErrorsOnly /v:quiet
/p:Configuration=ProductionRelease /p:Platform=\"Any CPU\" /t:Rebuild
Field\Product.Android.sln"
GetAndroidPackageName
This task will be failed majorly because your manifest file gets malframed, may be that manifest xml malframed, unncessary charecters might be present.
Remove them And your issue will be solved..
I'm trying to use SonarQube Scanner for MSBuild on a Xamarin project on macOS using mono. As MSBuild 15.0 is now shipped with Xamarin, I figured this could actually work.
I can successfully run the scanner's "begin" using mono like so:
mono sonar-scanner-msbuild-2/SonarQube.Scanner.MSBuild.exe begin /k:"KEY"
The command creates the following files:
.sonarqube/conf/SonarQubeAnalysisConfig.xml
.sonarqube/conf/SonarQubeRoslyn-cs.ruleset
.sonarqube/conf/cs/SonarLint.xml
Before running MSBuild, I've added the following import to the csproj files of my solution:
<Import Project="/Users/someuser/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore/SonarQube.Integration.ImportBefore.targets" />
I'm running MSBuild using:
msbuild /t:Rebuild
Now the build starts correctly but eventually terminates with two errors:
"/Users/someuser/Project/Project.sln" (Rebuild target) (1) ->
"/Users/someuser/Project/Project.UI.iOS/Project.UI.iOS.csproj" (Rebuild target) (2) ->
"/Users/someuser/Project/Project.Core/Project.Core.csproj" (default target) (3:3) ->
(CoreCompile target) ->
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/cs/SonarLint.xml' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/Project.Core_AnyCPU_Debug_1267/ProjectOutFolderPath.txt' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
Both files do exist in the filesystem, the first file was created in the scanner's begin invocation and the second file was created during the MSBuild execution.
Why would MSBuild not be able to find / access these two files? Is there anything that can be done about it?
After checking with the folks taking care of MSBuild, the solution has been provided in this Github issue thread:
To quote radical's comment from the Github issue:
You could try building with csc by passing /p:CscToolExe=csc.exe /p:CscToolPath=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/msbuild/15.0/bin/Roslyn/ to msbuild
Unfortunately, even though MSBuild works with the above adjustments, SonarQube fails afterwards. I will follow up with the SonarQube people to see whether this can be worked around.
I try to setup appveyor for my project on github. I added the "nuget restore" command to the pre build. But now I get this error message:
"C:\projects\moneyfox\Src\MoneyFox.sln" (default target) (1) ->
"C:\projects\moneyfox\Src\MoneyFox.Windows\MoneyFox.Windows.csproj" (default target) (2) ->
"C:\projects\moneyfox\Src\MoneyFox.Shared\MoneyFox.Shared.csproj" (default target) (3) ->
(EnsureNuGetPackageBuildImports target) ->
C:\projects\moneyfox\Src\MoneyFox.Shared\MoneyFox.Shared.csproj(276,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets.
"C:\projects\moneyfox\Src\MoneyFox
What am I missing?
I managed to fix it by first let appveyor select the build configuration by his own and second by execute nuget restore directly on the sln file:
nuget restore Src\MoneyFox.sln