Quantcast
Channel: MSBuild forum
Viewing all 2763 articles
Browse latest View live

Difference between Publish artifacts to Azure Pipelines & To publish a NuGet package as an Azure Artifacts feed

$
0
0

While using Azure Build pipeline, there is task called build solution using MS Build then publish artifacts and the publish location is azure pipeline. 

however in some course i saw other 2 steps where you use nuget packaging. and you do nuget pack then do nuget push to nuget artifact feed. i feel the 2 steps are pretty similar. if any one can illustrate what is different between the 2 approach


My generated js file from typescript are not used

$
0
0

Using Typescript and React on Visual Studio 2019, I compile correctly the say "ClientApp\Components\a.js" file when saving the corresponding "ClientApp\Components\a.tsx" file, but when I launch the Visual Studio debugger, the javascript source is taken from the folder wwwRoot/Dist/Main.js, and not from my a.js file. So it seems that the Main.js file is a concatenation of all the *.tsx files and that my a.js file is ignored.

On the Project Properties, I check "Compile on Save" (which is what I want).

MSBuild report error running code analysis: fatal error C1250: Unable to load plug-in

$
0
0

I got following error when compiling the c++ project with Build Tools 2017 in Windows container "windowservercore".

Running Code Analysis for C/C++...

c1xx : error C2220: warning treated as error - no 'object' file generated [C:\jenkins\workspace\ABC-DEV\ABC\ABC.vcxproj]
c1xx : fatal error C1250: Unable to load plug-in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\localespc.dll'. [C:\jenkins\workspace\ABC-DEV\ABC\ABC.vcxproj]

But it does not report this error when running the same compile script on a Win10.

The Win 10 installed with Build Tools 2017 and same work loads as the container.

localespc.dll is actually under 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin' in container.

Anyone knows how to resolve this?

Compile script:

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64

"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"  C:\Work\ABC.sln /p:configuration=Release /p:platform=x64 /t:rebuild



Patching VCTargets to support Android NDK r17 and later

$
0
0

Hello,

At Ubisoft, we have a custom CMake that we maintain with patches originally based on VCMDDAndroid to support the Visual Studio generator with Android. We recently faced issues when updating the NDK as the VCTargets file provided with Visual Studio 2019 only support the NDK up to version r16. We did some manual changes, but were hoping to see these changes incorporated directly in Visual Studio in a future update.

In C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Application Type\Android\3.0\

First, we patched Android.STL.props to remove android_support for newer NDKs.

--- Android.STL.props.backup  2019-08-06 13:40:36.518362100 +0000
+++ Android.STL.props.good  2019-09-23 08:35:16.162782600 +0000
@@ -76,13 +76,21 @@
   </PropertyGroup>
 
   <!-- Starting NDK16, use this order of include paths to support unified headers and the removal of old headers -->
-  <PropertyGroup Condition="'$(NDKVersion)' != '' and '$(NDKVersion)' &gt;= '16.0' and ('$(UseOfStl)' == 'c++_static' or '$(UseOfStl)' == 'c++_shared')">
+  <PropertyGroup Condition="'$(NDKVersion)' != '' and '$(NDKVersion)' &gt;= '16.0' and '$(NDKVersion)' &lt; '17.0' and ('$(UseOfStl)' == 'c++_static' or '$(UseOfStl)' == 'c++_shared')">
     <StlIncludeDirectories>$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\include;$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++abi\include</StlIncludeDirectories>
     <StlAdditionalDependencies Condition="'$(StlIsStaticLibrary)' == 'true'">$(StlLibraryPath)\libandroid_support.a;$(StlAdditionalDependencies);$(StlLibraryPath)\libc++abi.a</StlAdditionalDependencies>
     <!-- This convert StlLibraryName to an array -->
     <StlLibraryName>android_support;$(StlLibraryName);c++abi;</StlLibraryName>
   </PropertyGroup>
 
+  <!-- Starting NDK17, use this order of include paths to support unified headers and the removal of old headers -->
+  <PropertyGroup Condition="'$(NDKVersion)' != '' and '$(NDKVersion)' &gt;= '17.0' and ('$(UseOfStl)' == 'c++_static' or '$(UseOfStl)' == 'c++_shared')">
+    <StlIncludeDirectories>$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\include;$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++abi\include</StlIncludeDirectories>
+    <StlAdditionalDependencies Condition="'$(StlIsStaticLibrary)' == 'true'">$(StlAdditionalDependencies);$(StlLibraryPath)\libc++abi.a</StlAdditionalDependencies>
+    <!-- This convert StlLibraryName to an array -->
+    <StlLibraryName>$(StlLibraryName);c++abi;</StlLibraryName>
+  </PropertyGroup>
+
   <ItemDefinitionGroup>
     <ClCompile Condition="'$(UseOfStl)' == 'c++_static' or '$(UseOfStl)' == 'c++_shared'">
       <CppLanguageStandard>c++11</CppLanguageStandard>

Second, we patched the NDK version file, but the actual fix should be done in Android.NDK.props. This file load the LLVM version with the following code:

<LLVMVersion Condition="Exists('$(LLVMToolchainPrebuiltRoot)\AndroidVersion.txt')">$([System.IO.File]::ReadAllText('$(LLVMToolchainPrebuiltRoot)\AndroidVersion.txt').Trim())</LLVMVersion></PropertyGroup>

Recent NDKs however also have the commit hash in the file:

8.0.2
based on r339409

The code need to be updated to only extract 8.0.2 from this file, and discard the remaining.

ALINK: Error AL1047. Error Importing File

$
0
0

Hello all,

I am trying to get a build to work, but am having some issues.  Using Visual Studios 2012 with V6.0A AL.exe and v3.5 framework, I keep getting this error:

ALINK : error AL1047: Error importing file
'c:\Windows\System32\obj\debug\AICS.ARCHITECTURE.RESOURCES.dll' -- The system
cannot find the path specified.

Not entirely sure why, as this .dll file is present in the proper folder.  What could be causing this?  If any additional information is needed I can provide it.

Building CMake Project from Command line

$
0
0

Hey,

I have a CMake project with a few configurations in a CMakeSettings.json file. 

Is there a simple way to build one (or all) of the configurations defined in that file from the command line? 

Right now I don't see a way to do it without repeating the configuration in a batch file or parsing it out of the json. 

Thank you,

Alex

Vcpkg Libraries not detected by Visual Studio 2019 Community edition

$
0
0

Hi,

I am currently working on a Open-Source Project, which has some third-party library dependencies, I have installed all of them using Vcpkg into a particular folder in my E: drive and integrated them with Visual Studio with the "vcpkg integrate install" command, and supplied the Cmake toolchain also in the IDE.

But the libraries (ie. WxWidgets currently) are not being detected while configuring the build.

I am attaching the configuration message as well as the error snapshots below.

Any suggestions regarding this, would of great help.

Thanks & Regards.

 


when is a Target executed??

$
0
0

I've a custom file type (in a C++ project, like the .masm files -> BuildCustomization).

Its definition contains

<ItemGroup><AvailableItemName Include="MyFile"><Targets>MyTarget1</Targets></AvailableItemName></ItemGroup>

and I have

<PropertyGroup><BuildDependsOn>MyTarget2;$(BuildDependsOn)</BuildDependsOn></PropertyGroup>

and the 2 targets (just showing a text "SuperText + @(MyFile)") ...

this "works" in a way but I don't understand it

when I compile the project, the MyTarget2 is executed but not the MyTarget1 and when I compile a file by selecting it and right-click -> compile... then MyTarget1 is executed but not MyTarget2 ... I could understand the second one... but I don't understand why MyTarget1 is not executed when compiling the project. Can someone explain me that? Is this ... a bug in my script? Why could this be? Or is this normal? In this case... why?

I think... that I have copied everything exactly from the book Inside MsBuild.. the Doc2Html example... but maybe I'm still missing something... maybe I'm going and really copy pasting it and see if I can get this working... this simply cannot be that difficult... it cannot... that's impossible... and if it doesn't work, I'm going to install Visual Studio 2010 (because that's what they say they used...) and if this still doesn't work, I'm going to contact the author... that's... I don't know... in the end it's me missing a comma or a dot or one letter, word or file... or it's just that I didn't plant enough trees in the summer... whatever...

Rudolf



Release build crashing often

$
0
0
I am building my application in release mode and its often crashing. what is the best way to fix these issues and its works well in Debug Mode

saikalyan

is this ok?

$
0
0

I need to delete files. Those files are listed in a .log file and I also need to delete the logfile itself. I've written this like that... is this ok or would you do something different? Maybe adding anoter @ construct or whatever? (for example, writing the Condition and File parameter differently??) ... 

 

<Target ...><ItemGroup><IDLDeleteFiles /></ItemGroup><ReadLinesFromFile Condition="Exists('%(IDLDeletes.out)\%(IDLDeletes.Filename).log')" File="%(IDLDeletes.out)\%(IDLDeletes.Filename).log"><Output TaskParameter="Lines" ItemName="IDLDeleteFiles"/></ReadLinesFromFile><Delete Files="@(IDLDeleteFiles)" /><Delete Files="@(IDLDeletes->'%(out)\%(Filename).log')" /></Target>

Rudolf


order of resolution?

$
0
0

Explain me this please...

There is a _ResourceCompileDependsOn ... this contains a $(BeforeResourceCompileTargets); and others... and BeforeRecourseCompileTargets contains only ";BeforeResourceCompile;" ...

Now... I'm adding something (Target ahaa) to the BeforeResourceCompile... but, in the diagnose output I see that _ResourceCompileDependsOn does contain the old value of BeforeResourceCompile. Why?

When I instead add something to the _ResourceCompileDependsOn, then it is there and is executed.

What's the thing I'm not understanding here???

Rudolf

VS2015 MSBuild on build server cannot find cl.exe

$
0
0

I did try the Visual C++ Build Tools 2015 on a test build machine and it seems to work with my C++ solutions, but it is a pre-release and not meant for production. I need something that will work for production, so I have installed Microsoft Build Tools 2015, Windows 10 SDK, and Visual C++ Redistributable for Visual Studio 2015 and copied some of the files that are listed under Build Server lists.

The builds on the machine using the pre-release tools use "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe" when running MSBuild and the build completes, but my other machine uses just "CL.exe" when called with the same code and gives the error TRK0005: Failed to locate: "CL.exe". Clearly there is some kind of problem with environment variables being applied to the call to MSBuild, but I'm not sure where to look next. The system variables are the same on both machines, so something else is telling the machine with the pre-release tools where to find this path for CL.exe. 

Any help would be appreciated. 

Note: In case it helps, running CL.exe from a command prompt, I get an error saying it can't start because VCRUNTIME140.dll is missing. It is there in the System32 folder, which is in my Path. 

And if I try to use vcvarsall.bat, it claims it can't find Common Tools.

Common issues when porting applications to ARM64

$
0
0

Hello everyone,

In the past 6 months since I got my first Windows on ARM laptop I've ported several open source project to the platform and I thought it'd be a good idea to present all the common issues I've encountered and how I solved them. Generally targeting ARM64 should be as easy as changing the compiler target and recompiling however there are certain issues that can and do happen -


  • Third-party libraries - Just like x64 and x86, you can't combine code for different platforms in the same process, which means if the code you're poritng uses any external libraries you have to port them as well. It can take a while because you often have to port an entire dependency tree. My recommendation is to start with the most common libraries and work your way from there. The first library I've ported was zlib, simply because a lot of other libraries use it. I'd also note that the only thing that can completely prevent a port is if you're using binary-only libraries.
  • Assembly code - Well, it's a different processor and a different assembly language. Obviously any ASM code will have to be rewritten. Two solutions for this one - often libraries offer a C alternative for their ASM code, which can be used at the cost of a slight performance reduction (which is still faster than x86 emulation). Another possibility is that if the code is cross-platform it may already have an ARM implementation for another OS. If the ASM code does not make API calls then it may not be necessary to code everything from scratch.
  • Old compilers - The first version of Visual Studio to officially support the ARM64 target is VS2017. A lot of software uses older versions of the compiler, which can cause issues due to changes in the language and SDK. This is not ARM64 specific (it would happen even when compiling for x86 using new versions of VS) but needs to be taken care of since you don't have the option of using an old compiler. You will just need to go through the compiler errors and fix them one by one. My recommendation is to first build for x86 or x64, just to separate the new compiler issues and fix them before tackling any ARM64 specific issues.
  • 32-bit only software - Software that was never ported to x64 may have assumptions that are incorrect in any 64-bit platform (e.g. that sizeof(void*) == sizeof(int)). You will either have to deal with the port to 64-bit or just compile for ARM32, which runs on Windows on ARM at native speeds (just like x86 software runs on x64).
  • _M_AMD64 - This is a macro which is defined when targeting x64. Unfortunately some software rely on it as a general 64-bit check. That means that when you port it to ARM64 it'll assume it's being compiled for 32-bit machines, resulting in various errors such as incorrect pointer sizes. Either change it to check both _M_AMD64 and _M_ARM64 or even better just check _WIN64, which is defined on all 64-bit Windows platforms.

How to manually create a ipa file for iOS simulator platform build?

$
0
0
I need to test an application on a iOS simulator, but the iPA option cannot be checked for iOS simulator build. The ipa does not come out even though I manually modify the configuration xml file. Is there a way to work around that?

CreateAppHost Task Failed Unexpectedly

$
0
0

Just created a new Console Application project in C# and was not able to build it. Is there any way to fix this?

I haven't even touched the code:

using System;

namespace Catan
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

Here is my stack trace:

Error	MSB4018	The "CreateAppHost" task failed unexpectedly.
Microsoft.NET.HostModel.HResultException: 80070013
   at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__UpdateResources|1()
   at Microsoft.NET.HostModel.RetryUtil.RetryOnWin32Error(Action func)
   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom)
   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	Project	C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets	370		



[VS2019] Error: Task 'ValidateAppxManifest' failed. Unspecified error - again and again

$
0
0

The complete build error is

Task 'ValidateAppxManifest' failed. Unspecified error

'Microsoft Corporation' violates pattern constraint of '\bms-resource':.[1,256]'.

(In place of Microsoft Corporation could be anything)

'Microsoft Corporation' is in nuget packages describing the publisher.

After searching and reading related posts in the past, I resolved it by uninstalling and reinstalling VS and recreating the solution.

Last time, this method didn't work - except in debug mode. I moved to another computer which worked fine.

Only a few modifications in code and an update to VS 16.3.9 on the new PC and the error came up again.

In total, It is a waste of several weeks time.

Any help is greatly appreciated by everyone wasting time on non development issues.

thank you in advance

MSBuild Errors in a VS2019 Qt Project (Using Qt VS2019 Tools Extension)

$
0
0

Hi.

I have installed Qt version 5.13.2 on my machine and have also installed the VS2019 extension Qt VS2019 Tools.  I tried to use the extension to build a Qt project based on this Qt example.  First it read the build files and tried to invoke qmake which took around 24+ hours.  Then it reported a whole bunch of MSBuild errors which I've put in this Gist.  

I also mentioned this on the Qt Forums by the way.  I just thought it might be a good idea to mention it here as well since it concerns a Visual Studio extension and also an MSBuild issue related to it.  Any help is appreciated.  Thanks in advance.

Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=13.100.0.0

$
0
0
I am attempting to run a build in TFS 2018. We also have SQL Server 2016 installed on the TFS build server (which is Windows Server 2016). The first project (web project) produces the following error, and I have no idea from where this file is referenced:

2019-01-22T20:35:26.8607312Z Package:
2019-01-22T20:35:26.8608029Z   Invoking Web Deploy to generate the package with the following settings:
2019-01-22T20:35:26.8608667Z   $(LocalIisVersion) is 10
2019-01-22T20:35:26.8609527Z   $(DestinationIisVersion) is 10
2019-01-22T20:35:26.8610846Z   $(UseIis) is True
2019-01-22T20:35:26.8612479Z   $(IisUrl) is http://localhost:62327/
2019-01-22T20:35:26.8614266Z   $(IncludeIisSettings) is False
2019-01-22T20:35:26.8615630Z   $(_DeploymentUseIis) is False
2019-01-22T20:35:26.8617245Z   $(DestinationUseIis) is False
2019-01-22T20:35:26.8666548Z GenerateMsdeployManifestFiles:
2019-01-22T20:35:26.8684620Z   Generate source manifest file for Web Deploy package/publish ...
2019-01-22T20:35:27.0589951Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets(119,5): Error MSB4018: The "SqlScriptPreprocessSqlVariables" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=13.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.BatchParser, Version=13.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Lee

Blanking out macro list for property editor in VS 2019 community (not desirable)

$
0
0

The following properties file when placed with a simple CPP project file (I used Hello World.cpp found on the net I doubt one can get simpler than that) as Directory.Build.props will display the macro list when editing the Output Directory property for the project (even showing values for OUT1 and OUT2.  However removing the commenting from the second <OPT1> assignment will entirely blank the same Macro property list without generating an error in the load process.  Is this the desired or designed intended behavior when Substring should be returning an empty string and is probably returning NULL?

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
  <OPT1>vMacrosListisPopulated</OPT1>
  <!-- <OPT1>MacrosBlank</OPT1> -->
  <OPT2>
    $(OPT1.Substring(11))
  </OPT2>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="OPT2">
      <Value>$(OPT2)</Value>
    </BuildMacro>
  </ItemGroup>
</Project>

Jenkin Definition for microservice in .NET core

$
0
0

I have ASP.NET Core project with about 30 micro services. 

All applications live in the same repository and with same structure of each micro services.

Do we need to create 30 separate definition in Jenkin to give the build for all 30 micro services?

Or we have any approach where all 30 micro services can bind into one definition?

Viewing all 2763 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>