Using VS 2017 RTM (and the latest preview from 3/16/2017) I am unable to get Xamarin Forms IntelliSense working in a shared project that targets NetStandard 1.4. It works in a PCL but once I target NetStandard (or create a new project library targeting NetStandard) I get no IntelliSense. Here is the relevant section of the CSPROJ file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+net45+wp8+win81+wpa8;uap10.0;net46</PackageTargetFallback>
<AssemblyName>MyApp.AppX</AssemblyName>
<RootNamespace>MyApp.AppX</RootNamespace>
</PropertyGroup>
</Project>
It is a bug from Resharper and they have fixed in their latest beta. You can download the beta version of Resharper from here
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
I recently upgraded to Visual Studio Community 2019 16.5.2. Our Blazor Server application’s solution comprises of several projects and all of them are targeted to .NET Core 3.1
When I am trying to publish my application from Visual Studio, I get the below error:
NU1201 Project GCB.Storage is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0) / win-x64. Project GCB.Storage supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1)
Visual Studio says I get above error for project "GCB.Main" in GCB.Main.csproj. GCB.Main has a reference to the project GCB.Storage. Both of these projects’ target framework is set to .NET Core 3.1. I double checked all the dependencies and project references in both the projects and none of them depend on .NET Core 3.0
Microsoft documentation says that error might occur when "A dependency project doesn't contain a framework compatible with the current project. Typically, the project's target framework is a higher version than the consuming project."
Here are my publishing profile parameters in Visual Studio:
Configuration: Debug
Target framework: netcoreapp3.1
Deployment mode: Framework-Dependent
Target runtime: win-x64
I looked at control panel on the server where I am publishing and it has "Microsoft .NET Core SDK 3.1.201 (x64) from Visual Studio" update installed. Do I need to configure/install anything on the server? I do not see an entry for .NET Core Runtime 3.1 but I do see entries for MSFT .NET Core - 3.0.0 (x86), one for x64, and one for MSFT .NET Core 3.0.0 - Windows Server Hosting. Should I install .NET Core 3.1 runtime explicitly even though I installed Visual Studio 2019 16.5.2 on the same server?
Please note that I am able to compile/rebuild the solution without any errors on the same server where I am publishing it to. However when I try to publish I get above publishing errors.
Below is my pubxml
--
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ProjectGuid>a2939d6d-c286-40c3-a015-e946d67cd806</ProjectGuid>
<SelfContained>false</SelfContained>
<publishUrl>C:\GCB</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
--
Any pointers?
Thanks
It looks like the publishing profile is out of sync with the UX for whatever reason.
Update your pubxml file to <TargetFramework>netcoreapp3.1</TargetFramework> and it should publish without issues
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....
I have a standard VSIX project taking a project dependency on a class library project in the same solution. Everything was building just fine until I switched the class library to the new VS2017RC simplified csproj. The class library builds fine (my dotnet SDK is 1.0.0-preview4-004233), but when trying to build the VSIX I get:
error MSB4057: The target "BuiltProjectOutputGroupDependencies" does not exist in the project.
This obviously looks like an incompatibility with a traditional VSIX csproj expecting something from dependent projects that the new csproj doesn't provide.
Has anyone bumped into this or have any advice on working around it? I'm going to look into removing the project reference and manually referencing the output DLL.
As a related side note, it's unclear which output DLL the VSIX would select from the class library, as the new csproj supports multiple target frameworks.
As stated on the GitHub issue, here's a workaround:
Unload the VSIX project.
Right-click and edit its .csproj file.
Find the <ProjectReference> to the project which started causing the issue.
Add the element <AdditionalProperties>TargetFramework=net452</AdditionalProperties>, using the correct .NET Framework version you target in the referenced project.
Reload and rebuild the VSIX proejct.
I believe you may be encountering the same issue I had when I tried to reference my Visual Studio Extension from a .NET Standard library that was targeting multiple frameworks. There is a GitHub issue dotnet/sdk#433 about it.
What I had to do was remove my other targets. In my case, I had:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.3;net46</TargetFrameworks>
</PropertyGroup>
...
</Project>
And I had to modify it to only target netstandard1.3 (since it is compatible with .NET 4.6 according to the .NET Standard chart) and my VSIX targets .NET 4.6.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
</PropertyGroup>
...
</Project>
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