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.
Related
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
While I am building own Visual Studio Extension in TeamCity (same applies to any CI server build that supports building VS solutions), my build stucks on the step DeployVsixExtensionFiles. As far as I understand, the target is defined in VS Extensibility files and is being imported into any .csproj by default. I also realize that this is an "aka test" step that tries to embed an extension into a virtual copy of VS via running a command:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /RootSuffix Exp /ResetSettings General.vssettings /Embedding /Command File.Exit
I have two questions:
1. Should I disable this step for Release build of Extension?
2. If yes, how can this be done.
The VS SDK installs the extension as a part of a build so you can F5 and run it. If you're CI system doesn't care about that, update your CI configuration to pass /p:DeployExtension=false to MSBuild.
I have a Xamarin-based solution in Visual Studio 2015. One of the projects is an Android native shared library containing C++ code.
When I build the solution from within VS 2015 IDE, everything works as expected. However, when I try to build the solution from the command line I get an error.
The build command is:
msbuild mytest.sln /p:Configuration=Release /p:Platform=ARM /t:Rebuild
The error I get is:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Clang_3_8 (Platform Toolset = 'Clang_3_8') cannot be found. To build using the Clang_3_8 build tools, please install Clang_3_8 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...".
My Visual Studio 2015 has all the updates applied. Wondering if anyone knows what the problem could be. Is it a path problem? Regards.
Turned out it is a path problem. Make sure to use the developer command prompt link under Program Files-->Visual Studio 2015->Visual Studio Tools. This batch file sets up proper paths, including the one for clang.
I really want to use StyleCop with my Visual Studio 2013, but unfortunately it won't work. I've installed the 4.7 version from the official site, checking all options, both VS Studio integration and MSBuild integration, following the precise instructions (download, install while VS applications are closed, then start VS) but it just won't show up in my Visual Studio 2013.
The StyleCop website says that it should be compatible with VS2013. It won't show up anything related to StyleCop under tools and it won't show up the 'Run StyleCop' action when I right-click my C# project. Already tried the repair option from the installation menu and even re-installed it. Haven't made any progress.
Can someone please help me with this? Maybe one has had experience with this before? Thanks in advance!
Open Visual studio
Open Package Manager Console from TOOLS > LIBRARY PACKAGE MANAGER menu
Run the following command
install-package stylecop.msbuild
The above command will download the latest stable required dlls and files and integrate style cop with your project. Build your project and any stylecop errors will be shown in the warnings section.
If you don't find the package manager for some reason in the above menu, please refer this link for instructions on how to install http://surajdeshpande.wordpress.com/2013/10/18/how-to-install-a-nuget-package-in-visual-studio/
If you want your build to succeed only if all stylecop errors are fixed, you will need to make some changes to the project file to set a boolean to not treat stylecop errors as warnings.
Open the .csproj file for your project in notepad, and find the first PropertyGroup section within the file. Add a new tag to set the StyleCopTreatErrorsAsWarnings flag to false. For example:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4B4DB6AA-A021-4F95-92B7-B88B5B360228}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestProject</RootNamespace>
<AssemblyName>TestProject</AssemblyName>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
A sample proj file content with <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings> is shown above.
The build will be successful only after all sylecop errors are fixed.
Previous answers seems to be deprecated in 2015..
For VS Community 2013 Update 5:
1) Install "JetBrains ReSharper Ultimate 2015.2 [En]"
2) Go to Resharper-> Extensions:
3) Install Resharper.Stylecop from there
Update: Ok, for ReSharper Ultimate 10.0.2 + StyleCop by JetBrains 4.8
I get this error: https://resharper-support.jetbrains.com/hc/en-us/community/posts/206009179-StyleCop-integration-with-ReSharper-10-x-VS2015-
But there is recommendation to ignore this error. Seems to work after restart VS
(I also have reSP installed, for Sharepoint code analysis)
I have integrated the stylecops 4.7 with Visual Studio 2013 (Web) using following steps.
In order to integrate StyleCop with a project, an <Import> needs to be added to the .csproj file (versions and paths might differ):
If you used the official installer and installed the 'MSBuild integration' component, your <Import> will look like this:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- Your StyleCop <Import> will go here -->
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets" />
Note: You need to add the above line in each and every project in your solution.
Copy Settings.StyleCop in the project solution folder from C:\Program Files\StyleCop 4.7 on solution root folder or add as a solution item.
Double click the Settings.StyleCop file as configure the rules. You should be able to use the stylecops in your project.
Having an issue with a ResGen call during a build of a .NET 2.0 project from within Visual Studio .NET 2010, this thread suggests:
Add this to your MSBUILD command-line:
/p:ResGenExecuteAsTool=true;ResGenToolArchitecture=ManagedIL;ResGenTrackerSdkPath="%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64"
I've searched for hours without success trying to find a way to do this from within my Visual Studio .NET project.
Therefore my question is:
How can I change the MSBUILD command line of a .NET 2.0 (class library) project in Visual Studio 2010?
I have no fear changing my ".csproj" file, I would prefer not to change MSBuild files that were shipped with Visual Studio, if this is possible.
Update and solution:
Thanks to Oded's comment and answer, I added the following two lines:
<ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath>
<TrackFileAccess>false</TrackFileAccess>
right inside the very first <PropertyGroup> section of my ".csproj" file (i.e. after line 3). This made the file compile successfully!
I now check and see whether it also runs successfully.
Like all properties in MSBuild, what you can pass in through the command line can be added in the project file in XML elements instead.
For example:
<ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath>
And:
<ResGenExecuteAsTool>true</ResGenExecuteAsTool>
etc...