MaterialDesignInXAML / MaterialDesignInXamlToolkit

Google's Material Design in XAML & WPF, for C# & VB.Net.
http://materialdesigninxaml.net
MIT License
15.17k stars 3.43k forks source link

compiling error with VS2019 #2267

Closed supershabby closed 3 years ago

supershabby commented 3 years ago

Hi MD team, I'm getting compile error with VS2019 which comes with .net 4.7.2 while your solution is built on 4.5.2. I tried to change the Target Framework to 4.7.2 in the project property but it's disabled(guess it's related to that I dont have 4.5.2 installed on my machine), so I opened the project file and replaced net452 with net472 for targetFramework, unfortunately it doesn't work. I also tried to install .net framework 4.5.2 but got this error ".NET Framework 4.5.2 or a later update is already installed on this computer". Please advise, thanks in advance

Awsmolak commented 3 years ago

Update your Visual Studio.

Related VS bug fixed in Dec release: error NETSDK1005: Assets file 'project.assets.json' doesn't have a target for 'netcoreapp3.1'.

I also had to reset my repo after installing in order to get it to build.

Keboo commented 3 years ago

There is some additional documentation in the wiki about compiling from source. https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Compiling-From-Source.

To compile from source it does require VS 2019 version 16.8 or later. You will also need the .NET5 SDK in addition to the .NET framework SDK.

supershabby commented 3 years ago

There is some additional documentation in the wiki about compiling from source. https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Compiling-From-Source.

To compile from source it does require VS 2019 version 16.8 or later. You will also need the .NET5 SDK in addition to the .NET framework SDK.

There is some additional documentation in the wiki about compiling from source. https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/wiki/Compiling-From-Source.

To compile from source it does require VS 2019 version 16.8 or later. You will also need the .NET5 SDK in addition to the .NET framework SDK.

I have VS 2019 16.9 installed and .Net5 SDK installed but still doesn't work, pls advise

Keboo commented 3 years ago

Can you include the the MSbuild log (either from the command line with a dotnet build command, or the Output window in VS).

supershabby commented 3 years ago

Can you include the the MSbuild log (either from the command line with a dotnet build command, or the Output window in VS). Hi Keboo, below is the error, thanks in advance -- The reference assemblies for .NETFramework,Version=v4.5.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks MaterialDesignColors.Wpf C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets

Keboo commented 3 years ago

From that error it would appear that Visual Studio is not finding the needed .NET Framework SDKs. The easiest way to install them is to open the Visual Studio Installer, and select Modify. From there select the "Individual components" tab at the top, and select the ".NET Framework 4.5.2 targeting pack" and the ".NET Framework 4.7.2 targeting pack". For example mine looks like this: image

I have also updated the wiki page as well, as it did not include the information about .NET Framework SDKs.

supershabby commented 3 years ago

From that error it would appear that Visual Studio is not finding the needed .NET Framework SDKs. The easiest way to install them is to open the Visual Studio Installer, and select Modify. From there select the "Individual components" tab at the top, and select the ".NET Framework 4.5.2 targeting pack" and the ".NET Framework 4.7.2 targeting pack". For example mine looks like this: image

I have also updated the wiki page as well, as it did not include the information about .NET Framework SDKs.

That's the fix!! Thanks a lot!!