Mixed targets in VSTS build - continuous-integration

We have an aspnet-core application which consists of several .net standard libraries, two aspnet-core mvc applications and, exceptionally, a .net framework console application.
These all build successfully, both in solution in Visual Studio, and also individually using msbuild/dotnet build commands.
We are now trying to implement continuous integration/build with VSTS.
We have found that the aspnet-core web applications build successfully, but the .net framework console application fails with multiple error messages like the following:
2017-12-24T07:20:26.4090447Z C:\Program
Files\dotnet\sdk\2.0.3\Microsoft.Common.CurrentVersion.targets(1988,5):
warning MSB3245: Could not resolve this reference. Could not locate the
assembly "Xxx.Core, Version=1.1.0.0, Culture=neutral,
processorArchitecture=MSIL". Check to make sure the assembly exists on disk.
If this reference is required by your code, you may get compilation errors.
[d:\a\1\s\WinApps\ListBuilder\ListBuilder.csproj]
C:\Program Files\dotnet\sdk\2.0.3\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\1\s\WinApps\TelemListBuilder\TelemListBuilder.csproj]
The console application follows the same folder structure as the web applications but seems unable to find any of the referenced packages.
Our Agent queue is Hosted VS2017.
We have two VSTS tasks: Restore and Build from the asp.net core build template.
If necessary we would be happy if we could exclude the console app from the build.

Since there are general .net framework project and .net core project and you want to build them together, you need to use Visual Studio Build task.
So, remove .Net Core Restore and .Net Core build tasks and add NuGet Tool Installer (4.3.0), Nuget restore and Visual Studio Build tasks (Visual Studio Version: Latest or Visual Studio 2017)
If you want to generate the deployment package during the build, you can specify MSBuild arguments like this:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)"

Related

BizTalk project template in Visual Studio 2019 give UpdateVersionTask error

I have a working VS2019, I added the Extensions "BizTalk ESB Toolkit Initerary Designer" and "BizTalk Server" via "Manage Extensions" in VS2019
I have restarted VS and also my computer
I do not have BizTalk server 2020 installed on my computer
I do run VS2020 as admin
I can now add a BizTalk projects via "Add a new project" because there is a template named "BizTalk Server Application Project"
When I do this, I get a new BT project
But when I try to add new items, all I get is the "BizTalkServerInventory" option, no other items like schemas or orchestrations
In the New
Also, when I try to build I get the following error:
Error MSB4018 The "UpdateVersionTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. Det går inte att hitta filen.
File name: 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at Microsoft.BizTalk.ALM.JsonSchema.UpdateVersionTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
When I try to add Newtonsoft.Json I get
"Operation failed, The project ProjectName is unsuported"
And after this the "Manage NuGet Packages" i grey...
You need to have BizTalk (usually Developer edition) installed on the machine where you have Visual Studio, otherwise the DLLs that are needed for BizTalk solutions will not be there. And as per you question you also need to install the BizTalk extensions from the Visual Studio Market.
You can get away without configuring BizTalk in a Development environment, but usually it is more practical to also have it configured, so you can deploy locally using Visual Studio and quickly test changes. Otherwise you would have to have some sort build Server (that usually again requires BizTalk installed) or DevOps pipeline to compile and deploy to a BizTalk Server.

Visual Studio-DevExpress Click-Once dll's dependancy error

I have developed the Windows application.
I have used devexpress tool in that app.
I have used click once to publish the application to publish it.
while publishing first time, it I have added almost all devexpress dll's while publishing it.
Now, I am publishing next version and I have removed some dll's which are not req. and I am trying to publish it.
But It gives below error.
System.IO.FileNotFoundException: Could not load file or assembly
'DevExpress.XtraTreeList.v12.2, Version=12.2.5.0, Culture=neutral,
PublicKeyToken=b88d1754d700e49a' or one of its dependencies. The
system cannot find the file specified. File name:
'DevExpress.XtraTreeList.v12.2, Version=12.2.5.0, Culture=neutral,
PublicKeyToken=b88d1754d700e49a'
The error is because of earlier I have published with all dlls and now I am publishing with fewer dlls by removing/excluding unnecessary dll files from application Files.
So it showing dependency error.
How to solve this ?
It seems that in your application you are using the XtraTreeList control or controls which depends on it. If so the DevExpress.XtraTreeList.v12.2.dll assembly should be deployed.
You can check the lists of the assemblies required for deployment based on the product(s) you're using.
For example, if you are using reports? please check the Assemblies Deployed with Windows Forms Reporting Applications article.
There is an easy way to collect the DevExpress assemblies required for distribution of application - A tool for collecting the required DevExpress assemblies for further application deployment
To add required assemblies based on products you're using, in DevExpress Assembly Deployment Tool choose the By Products tag page and check the corresponding (XtraTreeList) item.

How to recompile Google Drive API sdk?

Here is our question: How can recompile Google drive api sdk in dotnet?
=> We didn't find the source code.
=> In the binary package, there a single source file not shipped with a project and we don't know what to do with it.
Reason of the question:
In dotnet, we're unable to use the latest Google Drive api dll downloaded from Google: Google.Apis.Drive.v2
We are getting compilation errors like:
Warning 10
The primary reference "Google.Apis.Drive.v2" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Google.Apis.Drive.v2" or retarget your application to a framework version which contains "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Cause:
This is because we are in Visual Studio 2010 with dotnet framework 4.0.
Apparently Google.Apis.Drive.v2 is compiled with dependencies to framework 4.5.
We cannot upgrade our project to Dotnet framework 4.5 because we have only Visual Studio 2010 and it would take months of testing upgrading to visual studio 2012.
Troubleshooting
We have tried to use Binding redirection in app.config files but it's not working with Class library projects that reference assemblies that need redirection (here Google.Apis.Drive.v2).
For information, binding redirection was working fine if we changed the project to console application but failed when we switched back to class library.
#Google support:
- Where do we download the source code of Google Drive api dll and how do we build it?
- Do you plan to ship a library for dotnet 4.0 because forcing 4.5 will block a lot of companies?
I finally found the source code for older versions (that compiled with .NET 3.5) at: http://code.google.com/p/google-api-dotnet-client/source/browse/Services/?repo=samples&name=1.3.0-beta (Google Drive in particular - it doesn't seem to exist in the main set).
I'm having trouble interacting with the source repository with Mercurial, but I was able to directly download the CS file and compile it in my own project. I'll edit if I learn more.
You can checkout the code from https://code.google.com/p/google-api-dotnet-client/source/browse/

Add Deployable Assemblies option missing from Visual Studio 2010

I've uploaded an MVC3 website and I'm getting this error:
Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
Having seen this before I know that it's an issue where the libraries I need aren't there. I have to bin deploy.
However I can't find the "Add Deployable Assemblies" option when I right click the project.
And according to this answer:
Starting with MVC 3 Tools Update we are now using Nuget package
references, which means that your project is automatically
bin-deployable. Since the tooling gesture is no longer necessary it
was removed from VS 11.
So why hasn't my application been "automatically bin-deployed" if this is the case?
Any suggestions?
Install Visual Studio 2010 Service Pack1 and you will get the option.
http://iwantmymvc.com/2011-03-23-bin-deploy-aspnet-mvc-3-visual-studio

MSBuild output vs Visual Studio output against a COM interop

I am attempting to a get a isolated build environment setup in my dev team.
The problem that I am presently hitting is a DotNet project which has a reference to a VB6 COM assembly.
The COM assembly is registered on the build system, but when I run msbuild against the sln I get the following error:
error MSB3303: Could not resolve COM reference "f630637a-718a-41c7-9c52-41f934dc4625" version 3.2. Object reference not set to an instance of an object.
The GUID for this assembly is correct, and if I load the solution up in Visual Studio it builds fine and generates Interop.* assemblies as required.
I do not wish to have the Visual Studio build as a requirement in the build steps.
How can I get msbuild from the command line to build the Interop assemblies the same as VS?
It appears that msbuild does not follow the project dependencies the same way as the IDE - as per this question
If I build the specific project that was failing before building the entire solution everything is good.

Resources