MSBuild outputs missing javascript files compiled with Typescript

We are using MSBuild on our CI server to compile our WebApp, however the assembly is missing JavaScript files generated by TypeScript from the assembly output.

I expect the output to contain JavaScript and not Typescript, however neither are output in the expected places.

How can I add JavaScript files without having to have them in my solution? The TypeScript team seems like this is bad, but I would rather not have duplicates of all files in my solution.

+3


source to share


4 answers


The problem was using MSBuild instead of Publish on the build server. I added that the AfterBuild target for content includes all JS files in the build output.

<Target Name="AfterBuild">
   <ItemGroup>
      <Content Include="**\*.js" />
   </ItemGroup>
</Target>

      



While not ideal, it keeps the js files from appearing in the solution when using visual studio, and the files end up being output.

+5


source


I tried many solutions from the internet including <Content Include="**\*.js" />

but nothing worked . I am using MSBuild in my local dev block and typescript is installed and targets are available in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript

.

It turns out my "old" MSBuild runner for csproj files for web applications is outdated. I did it:

MSBuild.exe my.csproj /Target:ResolveReferences;_CopyWebApplication /property:WebProjectOutputDir=myfolder;OutDir=myfolder\bin;Configuration=Debug 

      



but thanks to this post I need to use UseWPP_CopyWebApplication

instead of the old one _CopyWebApplication

:

MSBuild.exe /t:Rebuild "/p:WebProjectOutputDir=myfolder;OutDir=myfolder\bin;Configuration=Debug;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False" my.csproj

      

Now, without editing the csproj file, all my typescript are enabled!

+5


source


TypeScript is probably not installed on your build server. To install it, copy the TypeScript folder from c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\

to the same folder on the build server (where v12

is your Visual Studio version).

The version of Visual Studio on the build server can vary. In my situation, the version is on my development machine v12

and the build server is using v11

. I discovered this by adding the following to the file [WebProjectName].csproj

:

<Target Name="PrintVisualStudioInfo">
    <Message Text="VisualStudioVersion: '$(VisualStudioVersion)'" Importance="High" />
</Target>
<PropertyGroup>
    <CompileDependsOn>
        PrintVisualStudioInfo;
        $(CompileDependsOn)
    </CompileDependsOn>
</PropertyGroup>

      

Make sure to place it after the last item <Import />

. Now when you look at the output of your build on the build server, you should see "VisualStudioVersion: xx" somewhere.

Copy the folder TypeScript

to the correct version folder on the build server.

0


source


Just add in in case it helps people.
We recently had this problem and it was fixed by adding /p:VisualStudioVersion=12.0

to the BAT file:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe FullBuild.proj /p:VisualStudioVersion=12.0 /t:createRelease /p:ReleaseNumber=5.22.0

      

0


source







All Articles