Visual Studio Team Services build Typescript error - visual-studio

I have a angular2 webapplication where I'm using Typescript 2.0. I have install locally in my VS the version 2.0 and changed also the tag for the typescript version in my VS project. Locally vs build works fine. In my CD pipeline on Visual Studio Team Services with a vnext build now build fails with this:
2016-11-05T16:10:22.0371090Z C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe --project "C:\a\1\s\src\Emersy\tsconfig.json"
2016-11-05T16:10:22.7095466Z ##[error]VSTSC(0,0): Error TS5023: Build: Unknown compiler option 'strictNullChecks'.
Looks like that the build server is using the typesript version 1.8 is this possible?

Typescript 2.0 is not available in Hosted Build agent. But you could use Microsoft.TypeScript.MSBuild package instead, after that you could build your project on Hosted Agent with typescript 2.0.
Add/Install Microsoft.TypeScript.MSBuild package to your project
Edit your project file (.csproj)
a.) Configure MSBuild to use the NuGet package's props file.
<Import Project="..\packages\Microsoft.TypeScript.MSBuild.2.0.6\build\Microsoft.TypeScript.MSBuild.props" Condition="Exists('..\packages\Microsoft.TypeScript.MSBuild.2.0.3\build\Microsoft.TypeScript.MSBuild.props')" />
<!--<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />-->
b.) Configure MSBuild to use the NuGet package's targets file.
<Import Project="..\packages\Microsoft.TypeScript.MSBuild.2.0.6\build\Microsoft.TypeScript.MSBuild.targets" Condition="Exists('..\packages\Microsoft.TypeScript.MSBuild.2.0.6\build\Microsoft.TypeScript.MSBuild.targets')" />
<!--<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />-->
If it is .Net Core project, add this code to section of .xproj file
<TypeScriptToolsVersion>2.0.6</TypeScriptToolsVersion>
<TscToolPath>C:\Users\[user account]\.nuget\packages\Microsoft.TypeScript.MSBuild\2.0.6\tools\tsc</TscToolPath>

I don't think the Hosted build agents have support for TypeScript 2.0 at the moment.
From VisualStudio.com:
TypeScript 1.4 for Visual Studio 2013
TypeScript 1.6 for Visual Studio 2013 and Visual Studio 2015
TypeScript 1.7.5 for Visual Studio 2013
TypeScript 1.7.6 for Visual Studio 2015
TypeScript 1.8.6 for Visual Studio 2013 and Visual Studio 2015
WIX Toolset 3.10

TypeScript 2.0.6 is now available to the hosted build agent.
https://www.visualstudio.com/en-us/docs/build/admin/agents/hosted-pool

Related

How to build .vdproj in Azure DevOps pipeline

I am using windows self hosted agent with VS 2019 build tools installed. But in the build pipeline, I am unable to build ".vdproj" (.net framework 3.5) project. Please let me know whether installing of visual studio is the only option or any alternative approach available.
Thanks.
To build the .vdproj project, you will have to use devenv command to build the project.
Devenv.exe is the central Integrated Development Environment (IDE) for Visual Studio.
So you need to install the Visual Studio to get the Devenv.exe to build the project.
In Azure DevOps, you can add the Command Line Task and run the following command to build the .vdproj project.
For example:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe" MyProjectDir\MySolution.sln /Rebuild Release

Failed to install NuGet package 'SonarAnalyzer.CSharp' for project. Message: This package can only be installed on Visual Studio 2015

I am using Visual Studio 2017 and created Test Project to bind with SonarQube server using SonarLint. When I clicked on project to bind, I am getting below error.
"Binding solution to SonarQube project: Discovering solution projects
Included projects:
* TestSonar\TestSonar.csproj
Excluded projects:
* TestSonar.Tests\TestSonar.Tests.csproj
You can change the exclusion options via the SonarLint project-level context menu i.e. Solution Explorer -> Select project(s)
Binding solution to SonarQube project: Download quality profile(s):
Successfully downloaded quality profile. Name: 'Sonar way', Key: 'cs-sonar-way-54843', Language: 'C#'
Installing NuGet package 'SonarAnalyzer.CSharp' for project 'TestSonar'
Failed to install NuGet package 'SonarAnalyzer.CSharp' for project 'TestSonar'. Message: This package can only be installed on Visual Studio 2015.
Binding solution to SonarQube project: Generating project rule sets
Binding solution to SonarQube project: Not all NuGet packages were installed.
Please see output above for more information."
SonarC# started supporting Visual Studio 2017 after version 5.6, I guess you are using older version of the plugin and if you update to the latest, the message will disappear.

VS 2017 .NET Standard Class Library build error when trigger from TFS (VSTS)

My sln is built in VS2017 and contains several .Net Standard class library dll. Build always works successfully in my local machine/virtual machine, with VS UI or just use devenv.com via command-line.
But, when I use TFS to create build task, error about InternalVisibleTo shows.
When I use MSBuild,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "C:\WorkArea\xxxxx\_work\1\s\xxxxx\Main\Source\xxxx.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"C:\WorkArea\xxxxx\tasks\MSBuild\1.0.55\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=30268741-631d-4ac8-b4d2-d5b2774b61e7|SolutionDir=C:\WorkArea\xxxxx\_work\1\s\xxxx\Main\Source"*ForwardingLogger,"C:\WorkArea\xxxxx\tasks\MSBuild\1.0.55\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="Any CPU" /p:configuration="Debug" /p:_MSDeployUserAgent="TFS_6e1df8d0-1a29-425d-803c-d70779d0c76a_build_3175_345868"
it has the error:
When I use devenv.com,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com" "C:\WorkArea\xxxxxx\_work\1\s\xxxxx\Main\Source\xxxxxx.sln" /build "debug"
it has the error:
Is it a known issue or bug of Current Visual Studio 2017 (version 15.2 - 26430.6)? What's wrong with the AssemlyInfo? What's wrong with the TFS build?
You need to restore NuGet packages before attempting the build to resolve references to the reference assemblies that provide you the core types.
You can do this using msbuild /t:Restore (TFS/VSTS: use msbuild task) or nuget.exe restore (use a nuget.exe >= 4.0.0).
There must be some issue within the latest Visual Studio 2017. They, the Microsoft, change the project file structure of .Net Core / standard a lot from 2017 RC to current one.

Creating a NuGet package for Windows 7.1 SDK

I've been creating NuGet packages for some of my libraries. The goal is to have my Jenkins build server use a CoApp .autopkg script to build a NuGet package that I can then use in other projects.
The issue is that the build server uses the standalone Windows 7.1 SDK rather than Visual Studio 2010. I guess this is a separate Platform Toolset? So essentially, I can't use the packages compiled by the build server in my Visual Studio 2010 projects? Do people normally install a copy of Visual Studio on their build servers?
Are you using nuget.exe pack to create packages? You shouldn't need visual studio to run nuget.exe.
Here is a link to nuget.exe pack command reference - http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command

TypeScript / Visual Studio 2012 / Compilation parameters

I need to generate Source Maps when the TypeScript Compiler is executed from Visual Studio 2012. In Sublime Text 2, I just had to add an extra parameter to the build script.
I'm lost in VS 2012.
The Build section doesn't seem to have a section to add build parameters to the build process.
The command switch is "-sourcemap".
As such: tsc -sourcemap file.ts
Mads Kristensen's Web Essentials extension for Visual Studio added support for producing source maps automatically in version 1.3. You need to enable it in in Tools -> Options for Web Essentials. http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6
The free Express editions of Visual Studio does not support extensions.
There isn't a VS 2012 UI for editing the TypeScript build flags (yet) but you can get what you want by editing the project file and adding the -sourcemap flag to that build step.
<Target Name="BeforeBuild">
<Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" -sourcemap #(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
Follow the guide on this StackOverflow answer. replace --module amd to --sourcemap.
Visual Studio TypeScript Options
In 0.9.5 you can use the following:
Upload the project and in the property group and the following tag:
<TypeScriptSourceMap>true</TypeScriptSourceMap>
That make the job.

Resources