How to use Prism MVVM in WinUI 3 Desktop - mvvm

I am new to WinUI 3 and PRISM Library.
Do we have PRISM Library support in WinUI 3? If the answer is Yes, which is the the library?
After doing initial search...
I saw Prism.Uno is supporting WinUI 3. Is my understanding correct?
To try a sample, I have done below steps and created a WinUI 3 project:
Visual Studio 2019 Professional with all required components for WinUI3
Windows App SDK From Visual Studio, click on menu Extensions > Manage Extensions
After installing, create a new project by selecting "Blank App, Packaged (WinUI 3 in Desktop)" template.
Prism.Uno 8.1.97 From Visual Studio, click on menu Tools > NuGet Package Manager > Package Manager Console and type command "Install-Package Prism.Uno -Version 8.1.97"
Now after building the solution I am getting below error:
Error CS0433 The type 'DefaultOverloadAttribute' exists in both 'Microsoft.Windows.SDK.NET, Version=10.0.19041.21, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'Uno.Foundation, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'
How to resolve this error? Is this the right library I am referring?

Related

How to add linker additional dependencies into flutter desktop plugin for windows

I want to use CredUIPromptForWindowsCredentialsW function from windows api. But it require me add "Credui.lib" to linker additional dependencies.
With Visual studio we can go to Properties > Linker > All Options > Additional Dependencies then add it.
I saw it added to vcxproj file.
But with flutter plugin I can not see any file .sln or file .vcxproj, It is only auto generated by fullter.
How can I config linker file to flutter plugin ? In additional, How can we open windows folder as a project using Visual Studio as android folder using Android studio ?
Windows plugin builds are based on CMake, so you would use target_link_libraries in your plugin's CMakeLists.txt to add a library dependency.

Visual Studio Code: Is there a way to build and debug in one step?

Is there a way to build a target and debug that target all in one step in Visual Studio Code? This would be similar to the Build before running setup in Visual Studio. I'm running version 1.27.2 on Windows 7 and developing C code.
I already set a default item to build in my tasks.json file, and I have a default item configured in my debug settings. I'm wondering if I can configure VS Code to do both items with one command, or a setting where I can configure my project to build before running/debugging.

Is there a way to use shared projects (shproj) in Visual Studio Code?

Hi,
Shared project seemed like a good idea to share code between .NET Core 2.0 web project and .NET 4.7 WinForms project.
I have bunch of extensions inside as well as web api client code which is used by both projects.
Everything works well in Visual Studio 2017.
However, on the road I use MacBook computer with Visual Studio Code which does not recognise shproj in any way. I also tried Insider version with new multiple workspace, but that also seem to work only with actual projects (csproj).
I know there is Visual Studio for Mac, but it is huge and far exceeds my on-the-road needs, so I would like to avoid it.
So, my question is - is there a way to utilize Visual Studio Code with projects that use shared projects (shproj)?
I would like to run/debug such projects in VSCode.
If not, does it make sense to create feature request somewhere? I mean, shared projects were designed for cross-platform code sharing and VSCode is brilliant cross-platform editor so it makes sense.
Or is this not part of VSCode at all, but some extension (like OmniSharp)?
Thanks,
Mario
At least now (2021) it seems to work fine.
TLDR; Create a new project with Visual Studio (2019) and add a "Shared Project" to that Project/Solution. Then open the project folder in Visual Studio Code and add the Shared Project folder to Workspace. In VS Code add a new Class to the Shared Project and adjust the *.projitems file to include the new class in the compile process. Run the project in both VS Code and VS to verify everything works as expected.
Following are the steps that I used. It looks like a lot, but it should only take about 10 minutes to setup this basic sample.
Open Visual Studio (2019)
Create a new "Console App (.NET Core)", give it a name and a location and select "Place solution and project in the same directory".
After creating the project you should have a new solution in "Solution Explorer" containing the new Console Application project.
Right-Click on the solution and select "Add" > "New Project..."
Select and add a new "Shared Project"
Add a new class to your Shared Project. In "Solution Explorer" right-click the shared project and select "Add" > "New Item..." and select the "Class" template.
In your "Console Application" add a reference to your Shared Project by right-clicking on your Console Application project, then select "Add" > "Shared Project Reference..." and select the listed shared project (*.shproj)
Use the new class of the Shared Project in the Console Application project
Run the Console Application to check if it builds and uses the shared class successfully.
Close Visual Studio (2019)
Open Visual Studio Code
Select "File" > "Open Folder" and select the folder where the Console Application is placed.
Note: If VS Code shows a message "Required assets to build and ... are missing" then select "Yes".
Select "File" > "Add Folder to Workspace..." and select the folder where the Shared Project is located.
Select "File" > "Save Workspace As..." and save the file to the project folder of the Console Application.
Open a new integrated Terminal in VS Code (in Menu "Terminal" > "New Terminal") and make sure that the current working directory is the folder of the Console Application. Then type "dotnet clean && dotnet run" to clean, build and run the solution.
Assuming we now want to add a new Class to the Shared Project from Visual Studio Code, we have to do some extra work, that normally Visual Studio (2019) would do for us when adding a new Class.
In VS Code right-click the folder where your shared class is located and add a new File. Give it a name with .cs extension and add the according code to the file to make it a valid class file.
Open the *.projitems file and find the part where your first class file has been added already. It should look like this:
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SharedClass1.cs" />
</ItemGroup>
Now add the new class file to this ItemGroup section like this
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SharedClass1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SharedClass2.cs" />
</ItemGroup>
Use the new class in the Console Application, save all files and type "dotnet run" in the integrated Terminal.
Check if everything builds and runs as expected.
If you notice that it builds successfully, but VS Code shows some error like "The type or namespace name 'Class2' does not exist in the namespace 'SharedProject1'", then restart VS Code. After restart it should be able to detect everything as expected.
Close VS Code and Open VS (2019) by double-clicking the *.sln file.
Build and Run the project to verify that all changes are compatible with VS (2019).

Visual Studio 2017 WebSite Menu "Enable C# 6 / VB 14" fails to load Nuget Package

Since a while whenever I click on the WebSite menu "Enable C# 6 / VB 14" I get an exception message saying that "Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2" is not found in following primary resource(s): "C:\Program Files (x86)\Microsoft Web Tools\Packages"
I check the folder and see that it is upgraded to version 1.0.3. (C:\Program Files (x86)\Microsoft Web Tools\Packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3)
How can I bring the menu again intact in order to point to the correct version?
How can I bring the menu again intact in order to point to the correct version?
If you want to bring the menu again, you should uninstall the the package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" from your website project.
Then point to the correct version.
Besides, if you want to resolve the error "Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2" is not found ...", you can download that package from nuget.org with version 1.0.2. Then set it to the folder C:\Program Files (x86)\Microsoft Web Tools\Packages\. In this case, you will never get that error when you enable "Enable C# 6 / VB 14".

Add existing project in a solution - cause reference namespace error

I just create a new project. And then add an existing project in that new project.
The problem is after finish to add that existing project. All the reference are missing error.
Just to know. The existing project i added, was already added in another project and use the "restore nuget package"
The following error appear :
"Some NuGet packages are missing from this solution. Click to restore from your online package sources"
But after try to restore the package i get the new following message :
"All packages are already installed and there is nothing to restore."
Both use the same Framework version - 4.5.2
I finally find the solution. It's was because i open the solution with VS 2015 but the project i added was created with Visual Studio 2013 , i think nuget package have some bug for restore package from VS 2013 to VS 2015
First open my solution with (Visual Studio 2013),software that I created the referenced project
Click on the option "Restore the nuget package" from the solution
Re-open the solution on Visual Studio 2015 and then enjoy ^^