WinUI3 EntryPointNotFoundException After VS 17.1.2 Update - xaml

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

Related

missing "System" reference on ubuntu and .net core 3.0

I'm trying to develop a simple web app using .Net Core 3.0 on an Ubuntu machine.
I setup the .Net Core SDK and the runtime from this link. I setup VS Code and then I create a project using the following commands dotnet new webapp -o RazorPagesMovie code -r RazorPagesMovie
I built the project and it is working. But in VS Code, it shows the following error:
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
screenshot of vs code
Regarding your problem, there are multiple open issues on omnisharp-vscode (e.g. 3289, 3290) GitHub repository. A few workarounds are available as follows:
For Windows: install Visual Studio 2019 Community Edition, or MsBuild Tools 2019
For Linux/MacOS: install Mono 6.0.0 or newer
Or uninstall the previous versions of .NET Core. If you don't like these workarounds, the best solution to fix the issue is that installing the new (beta) OmniSharp build for the time being.
You can install this build by adding the following line into your VS Code settings.json:
"omnisharp.path": "1.34.4-beta.7"
Once you save the settings, the new build of omnisharp-vscode with fix will be installed. After the installation, restart IDE if required. I can confirm that the fix works for Windows.
I often get a similar message on .net core 2.x and I find that you have to add the reference to netstandard into the project file to fix as below:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
..
</PropertyGroup>
<ItemGroup>
..
</ItemGroup>
<ItemGroup> <Reference Include="netstandard" /> </ItemGroup>
</Project>
On Mac I tried removing old dot net runtimes and sdks, using the preview version of omnisharp and verifying mono version above 6.0.0
I also deleted project bin and obj dirs, recompiled, deleted nuget cache dirs and restored.
Then I ran across this in related post:
ACK! Upgrading to Mono 6.4 solves problem under Linux!
(Under Mono 6.0 problem occurs as I have had this version before)
Not 6.0 necessarily....

There was an error running the selected code generator: Could not load file or assembly Microsoft.EntityFrameworkCore, version = 2.0.1.0

When I was creating a Controller and a View by MVC Controller with views, using Entity Framework I got an error.
The Error is:
There was an error running the selected code generator: 'Could not
load file or assembly Microsoft.EntityFrameworkCore, version =
2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' the located assembly's manifest definition does not match the assembly reference
Creating MVC Controller with views, using Entity Framework:
How can I solve this problem?
I use Visual Studio Version 15.5.2 and version of Microsoft.AspNetCore.All is 2.0.0
I updated the Microsoft.AspNetCore.All to version 2.0.3 and now it does work right.
Go to NugetPackage Manager and update the Microsoft.AspNetCore.All package
For me none of the above solutions worked. I had to add Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Design packages even though I have Microsoft.AspNetCore.All package added to my project.
Edit project in VS 2017 and add these lines
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.3" />
Update your packages or it can happen when you have an older SDK. Download a new .NET Core SDK and runtime from www.microsoft.com/net
I had a similar issue but mine was something with the versioning of visual studio.
I went to Visual Studio Installer and it notified me that I had to restart my computer
I got this same error:
Running Preview 2019 and .NET Core 3.
I moved the Nuget pkg sources up in my list.
I was attemping to add a new Controller and I would get this error every time.
I also noticed that for some reason I chose not to set up SSL but I had the setting in my launchSettings.json.
I deleted the setting for ssl and built the app and ran it.
After the successful run I could add the Controller without the error.
Follow these Steps:-
From Tools
Select NuGet Package Manager
-> Manage NuGet Packages For Solution
click on ->Updates Select the checkbox Select All
->Select Your Project from right hand side -> Click on Upadate
Having the same error, after downloaded VS2019"PREVIEW" and then opened a core 3.0 project there I was able to scaffold content no errors at all..

Visual Studio 2013 - the system cannot find reference specified

I googled and checked existing post here but didn't find any relevant post so here is my question.
I am using VS2013 Primium edition. I have few class library projects(all using framework 4.0). When these class libraries become part of Web Solution, reference paths in the class library are shown and project compiles fine as shown below.
However, same class library project doesn't load reference paths when it becomes part of Windows Service Solution.
I doubled checked all my projects are using same framework version. Any idea whats going wrong?
finally I am able to resolve it.
After recreated my library project inside my Windows Service Solution as described here.
I opened same library project in my web solution. Somehow, my web solution adds nuGet restore tags in my library project file.
<RestorePackages>true</RestorePackages>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
These tags were causing trouble. Once I removed those tags as described here. it fixed my issue.

VS 2017 RC, F5 doesn't work with project configured for target "framework" (net462): The "RunCommand" property is not defined

To configure asp.net-core project to use "framework" target (net462) it is required to delete package from csproj file:
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
Because it is for "Core" platform only.
May be because of this Visual Studio F5 button (Run) stopped working:
Is it possible to "reintegrate" asp.core targeted to net462 with Visual Studio?
ToolsVersion problem:
One question aside, what we should know about ToolsVersion from <Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0"> ? Till that moment I thought that we should worry about dotnet -v (aka tooling version). How to know which sdk's "ToolsVersion" is the last and which is actually installed on developer's computer?
Reproducing
I can't reproduce it with VS default ASP.CORE projects.
It is happens only with Spa Services projects.
As "The Pax Bisonica" suggested in comments:
Changing:
<OutputType>winexe</OutputType>
To:
<OutputType>Exe</OutputType>
helps, but only after Visual Studio restart (dotnet restore and dotnet build is not enough!!!).
Together I have removed /bin and /obj folders so may be those steps also need to be included.
About:
<Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">
As I understand there ToolsVersion shares its value "15" from "Visual Studio 15" - prerelease/development name of Visual Studio 2017. I can't find an information about plans to change it with VS 2017 release. VS 2015's editions ToolsVersion = 14

asp.net core xproj file has import that doesn't exist on Ubuntu

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).