Open AleksandarDevic opened 8 months ago
Hi @AleksandarDevic. In the provided screenshot, I don't see the solution explorer at the left. I can only see your MAUI project folder opened as a workspace. Do you have the C#, C# DevKit and MAUI DevKit extensions installed? If so, could you please share the content of the C#, C# DevKit and .NET MAUI output panes? Thanks
Yes, I have all the extensions and their versions you can see in the first message. Screenshoots:
The needs-more-info
label has been removed since the original bug filer has responded since the label was originally set.
I am experiencing the same event.
dotnet new wpf
.
I just opened a new project created with this command and now I get the same error.
It does not affect the build, but it is not very good mentally.
windows 10, dotnet 8.0.204. Non wpf cli projects are fine. Visual studio not vscode is fine.
Hi, @mauroa , any info, because the same thing on the latest .Net9?
It also looks like this was an ongoing issue with the previous OmniSharp C# extension as well.
Pretty straightforward to repro with dotnet new wpf
and open in VSCode with devkit enabled. Will get this error
Works fine with C# extension standalone.
@tmeschter / @lifengl - IIRC what fixed this for the C# ext standalone was ensuring the DesignTimeMarkupCompilation
target ran if available in the design time build. Not sure if that is applicable to devkit.
FYI there is a good amount of upvotes on this issue here - https://github.com/dotnet/vscode-csharp/issues/5958
I still have the same problems. Have you already found a solution?
The same to you ┭┮﹏┭┮
There is a way to fix the problem temporarily.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>ControlLearn</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) < 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
+ <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>
<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
+ <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
+ <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
+ <Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix"/>
</ItemGroup>
<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
</Project>
you have to make sure that your
PackageReference
and the<SupportedOSPlatformVersion>&<WindowsSdkPackageVersion>
are added
is there any info about this? this problem is very annoying and i would like to use Omnisharp instead of the C# extension
Describe the Issue
When I create a simple MAUI project, in file MauiApp1\Platforms\Windows\App.xaml.cs for method InitializeComponent I get a compiler error: 'App' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'App' could be found (are you missing a using directive or an assembly reference?)CS1061.
But when I do dotnet build I get info Build Succeeded!
Steps To Reproduce
I created a simple MAUI project.
In file MauiApp1\Platforms\Windows\App.xaml.cs, for method InitializeComponent I get compiler error: 'App' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'App' could be found (are you missing a using directive or an assembly reference?)CS1061.
But when I do dotnet build I get info Build Succeeded!
Expected Behavior
The compiler should recognize the method InitializeComponent from MauiWinUIApplication class.
Environment Information