So I am using the Hosted agent to run builds. We need to compile our site which uses typescript 2.0. In the build configuration when we switch our Visual Studio Version to VS '15' (preview) the following happens during the build.
Is there some sort of configuration I have to do to make this work?
The Visual Studio 15 is not available on Hosted agent, also there isn’t typescript 2.0 installed on hosted agent.
You can add TypeScript MSBuild task package (2.0.6) to your project and using it to compile typescript files.
Install Microsoft.TypeScript.MSBuild package
Edit your project file (.csproj):
1:
<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')" />-->
2:
<!--<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />-->
<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')" />
Related
I just installed Visual Studio 2022 17.2.1 and my WinUI3 Project does not run anymore.
Even the installed app on my computer doesn't open.
When I try to compile and run within VS the follow error is generated
System.EntryPointNotFoundException: 'Unable to find an entry point
named 'XamlCheckProcessRequirements' in DLL 'Microsoft.ui.xaml.dll'.'
if dotnet build
I tried to reinstall Visual Studio
Use Preview Version 17.3
Try solutions on this thread https://github.com/microsoft/WindowsAppSDK/issues/1762
After the update...the Microsoft.Ui.Xaml nuget package was causing the error.
Removing it solved to problem.
<PackageReference Include="Microsoft.UI.Xaml" Version="2.7.1"/>
I also had the problem. I believe, I could fix the problem by creating the WinUI3 project using the correct project template.
Before, I used the "Windows App SDK extension" in Visual Studio 2022. Then I removed this extension and instead installed the item "Windows APP SDK C# Templates" from the Visual Studio installer (item from "Installation details").
With the new / correct project template "Empty App, packaged (WinUI 3 in Desktop), I created a WinUI 3 project.
Here you find the relevant parts of the .cjproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>MyApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
</Project>
You can see, that two Nuget Packages are required:
Microsoft.WindowsAppSDK and Microsoft.Windows.SDK.BuildTools.
As you see, I used Windows App SDK 1.1.2 at that time. (I you publish an unpackaged app, the respective Window App SDK needs to be installed on the system, i can be found here)
In the project settings, take a look at the value in TargetFramework value. It seems that a value of simply "net6.0" does not work. In this post you will find this statement:
Changing net5.0-windows10.0.19041.0
to net6.0-windows10.0.19041.0
worked for me, too.
Delete the version of your Microsoft.ui.xaml in this path and try to run your project. This solution worked for me
C:\Users\UserName\.nuget\packages\microsoft.ui.xaml
The new core 2 directory services are described here https://learn.microsoft.com/en-gb/dotnet/api/system.directoryservices?view=netcore-2.0
I have Visual Studio 2017 and the Core 2 SDK installed but can't reference the newly added directory services, how do I install these?
Can't find them in object browser.
Using PMC install-package System.DirectoryServices gives me v4.0
<ItemGroup>
<PackageReference Include="System.DirectoryServices" Version="4.0.0" />
</ItemGroup>
and the following warning
Package 'System.DirectoryServices 4.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
Using 'manage packages' only shows the unsupported version by bmars.
Any ideas?
Thanks,
Andy
Microsoft has a MyGet feed that has a preview package of System.DirectoryServices which should be able to work with ASP.NET Core 2.0
https://dotnet.myget.org/feed/dotnet-core/package/nuget/System.DirectoryServices
I created an ASP.NET core application with Visual Studio and the .NET core tools. It runs fine on Windows, but when I copy it to Ubuntu for deployment and then run it, I get:
....xproj(7,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/1.0.0-preview4-004233/Microsoft/VisualStudio/v14.0/DotNet/Microsoft.DotNet.Props" was not found.
Which makes sense, because Visual Studio isn't installed on Ubuntu. Why is it there? I tried removing the import from the xproj and that causes other problems:
error MSB4057: The target "Build" does not exist in the project.
Here's the xproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>ca453b3a-1bb5-4ed8-bbe5-fe1e627a9f76</ProjectGuid>
<RootNamespace>abc</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
I'm new to ASP.NET core, and currently lost in a sea of versions, tools, previews... I think the VS tools targets 1.0.0, but when I installed dotnet core on linux I got 1.1.0, so I also installed 1.0.0 and use
dotnet run --framework 1.0.0
What am I supposed to be doing to create a web project in VS (2015) and deploy it to linux?
UPDATE from further googling I found (https://github.com/aspnet/EntityFramework/issues/5420) that I should install ".NET Core Tooling Preview 1 for Visual Studio 2015", but I can't do that because I'm on linux, so what should I do?
Is it not possible to develop a web app in VS and deploy to linux?
UPDATE 2
Ok, so despite everything I'm reading saying that you run a web app with dotnet run, I found here that I should use dotnet myDLL.dll (and that works, on Windows at least I haven't tried on Linux yet)
So what's the reason? Core versions?
dotnet run is much better than having to know the correct DLL name, so I'm guessing dotnet run is for v1.1? Have I somehow built my project for v1.0?
I am lost with all the versioning and previews etc etc, I'd appreciate a explanation. I thought I was downloading the latest stuff, and I thought the VS toolkit was version agnostic?
I am a bit confused about the .xproj file on your Linux machine. If you publish your web app locally you should not see an .xproj file in between the published files. Because .xproj is only a file Visual Studio needs. Dotnet core only needs a project.json file and a void static main to function.
1) Try the guide in this link https://learn.microsoft.com/en-us/aspnet/core/publishing/linuxproduction
2) Or follow the guidelines from Scott Hanselman's post: http://www.hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMHost.aspx
I found out that the correct way to do it (for SDK 1.0.0) is
Publish from VS
Copy content of publish output folder to Linux
Run it with dotnet myapp.dll (instead of dotnet run).
I want to install phantomJS nuget package for my .NET Core project. This nuget package contains an .exe file (phantomjs.exe).
(C:\Users\.nuget\packages\PhantomJS\2.1.1\tools\phantomjs)
Building or publishing solution doesn't copy .exe file inside the bin or publish folder.
Do I have to add a specific configuration in my project.json to automatically copy .exe when I'll publish or build??
Currently PhantomJS nuget package (v.2.1.1) targets classic windows-only .NET projects; phantomjs.exe is included into 'tools' folder and on install nuget executes script (install.ps1) that adds 'phantomjs.exe' to the project with CopyToOutputDirectory=true option. Unfortunately install scripts are not supported for netcore projects; since PhantomJS nuget package doesn't include any managed assemblies, it can be installed for netcore project but 'tools' folder is ignored.
It is possible to use "script" section in project.json ("postcompile"/"postpublish" mentioned by #Pawel) to copy phantomjs.exe explicitly, but it seems there are no any acceptable way to resolve path to PhantomJS nuget package during build procedure. In any way, PhantomJS nuget package includes only windows PhantomJS build and it is useless if you planning to run your .NET Core project under Linux or OS-X.
Maybe it is better avoid using PhantomJS nuget for netcore projects at all, and create custom build script (executed with "postcompile") that downloads and extracts appropriate phantomjs build for your target runtime platform.
I found the following worked for copying the exe to the output folder on publish:
<Target Name="PhantomJsOnBuild" AfterTargets="Build">
<Copy SourceFiles="$(NugetPackageRoot)PhantomJS\2.1.1\tools\phantomjs\phantomjs.exe" DestinationFolder="$(OutputPath)" />
</Target>
<Target Name="PhantomJsOnPublish" AfterTargets="Publish">
<Copy SourceFiles="$(NugetPackageRoot)PhantomJS\2.1.1\tools\phantomjs\phantomjs.exe" DestinationFolder="$(PublishDir)" />
</Target>
I just realised I can not run my vdproj file from msbuild without calling Visual Studio.
What a showstopper for atomated builds!
Can you recommend another installer, that allows to compile your setup for a .NET 2.0 Winform-application from commandline?
WIX see:
http://wix.sourceforge.net/
Established, open source MSi based installer. Better still you can migrate buildt msi's from the output of your vdproj. Plus you not longer need to have visual studio to do your builds.
Most any other installer tool can. Inno Setup, NSIS, etc.
We have an automated build setup that uses calls .vdproj files from TeamCity. One key component is that we had to automate generating a new GUID every time we do a deployment build. (Perhaps that is the "showstopper" you were referring to.) Here is a workaround that supports it:
http://www.codeproject.com/KB/install/VersionVDProj.aspx
It parses your .vdproj file and updates the Package and Product codes. Here are some relevant snippets from our MsBuild file that do the deployment setup:
<Target Name="Update-Vdproj-Version">
<Exec Command="Tools\VersionVDProj\VersionVDProj.exe -msi Deployment\KillerAppSetup\KipperAppSetup.vdproj version=$(Release)" />
</Target>
<Target Name="Build-Setup">
<Exec Command="$(DevenvPath) KillerAppSetup.sln /build Release" WorkingDirectory="Deployment\KillerAppSetup\" />
</Target>
So, it can be done, and it is being done!:) Granted that Visual Studio Setup and Deployment projects are fairly primitive, but if they are all you need, this works.