Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build win latest nuget on net45 #971

Closed
xmarshal opened this issue Feb 16, 2021 · 11 comments
Closed

Unable to build win latest nuget on net45 #971

xmarshal opened this issue Feb 16, 2021 · 11 comments

Comments

@xmarshal
Copy link
Contributor

@oleg-shilo
image
Build started... 1>------ Build started: Project: SetupBuilderTest, Configuration: Debug Any CPU ------ 1>Build started 16.02.2021 15:07:33. 1>Target BeforeBuild: 1> Copying file from "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\nbsbuilder.exe" to "C:\Users\xbart\Documents\Sources\Research\WIx#\SetupBuilderTest\SetupBuilderTest\bin\Debug\net45\nbsbuilder.exe". 1>Target ResolveAssemblyReferences: 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.Msi.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp.Msi, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp.Msi, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>Done building target "ResolveAssemblyReferences" in project "SetupBuilderTest.csproj". 1>Target _WriteAppConfigWithSupportedRuntime: 1> Skipping target "_WriteAppConfigWithSupportedRuntime" because all output files are up-to-date with respect to the input files. 1>Target GenerateBindingRedirects: 1> No suggested binding redirects from ResolveAssemblyReferences. 1>Target GenerateTargetFrameworkMonikerAttribute: 1> Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files. 1>Target CoreGenerateAssemblyInfo: 1> Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files. 1>Target CoreCompile: 1> Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn 1> C:\Users\xbart\Documents\Sources\Research\WIx#\SetupBuilderTest\SetupBuilderTest\Program.cs(3,11,3,19): error CS0246: The type or namespace name 'WixSharp' could not be found (are you missing a using directive or an assembly reference?) 1>Done building target "CoreCompile" in project "SetupBuilderTest.csproj" -- FAILED. 1> 1>Done building project "SetupBuilderTest.csproj" -- FAILED. 1> 1>Build FAILED. 1> 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.Msi.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp.Msi, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp.Msi, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3274: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3275: The primary reference "C:\Users\xbart\.nuget\packages\wixsharp.bin\1.16.1-hotfix\lib\WixSharp.UI.dll" could not be resolved because it has an indirect dependency on the assembly "WixSharp, Version=1.16.1.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2" which was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". 1>C:\Users\xbart\Documents\Sources\Research\WIx#\SetupBuilderTest\SetupBuilderTest\Program.cs(3,11,3,19): error CS0246: The type or namespace name 'WixSharp' could not be found (are you missing a using directive or an assembly reference?) 1> 6 Warning(s) 1> 1 Error(s) 1> 1>Time Elapsed 00:00:00.23 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@geghamyan
Copy link
Contributor

@oleg-shilo, I propose to retarget to .Net 4.5.1

Why it is a balanced alternative ?

  • It's modern enough to contain useful classes and features
  • It comes pre-installed on Win 8.1 and above, so no additional installation is required
  • It's the last .Net framework which doesn't require SHA2 patches on Win7 OS, which installations requires reboot and it's not desirable for small utility installers

References
https://docs.microsoft.com/en-us/archive/blogs/astebner/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os

http://web.archive.org/web/20201231080246/https://support.microsoft.com/en-us/help/4472027/2019-sha-2-code-signing-support-requirement-for-windows-and-wsus

@oleg-shilo
Copy link
Owner

Agree.
And indeed it is not an easy balance. You want to have the oldest version to give you the maximum compatibility and the latest one to get the modern framework features.
But will need to POC it first to see if any problems

@oleg-shilo
Copy link
Owner

All good builds OK

@onefreddy
Copy link

I believe that the installer should be as independent as possible from the installations in the system. I urge you not to make sudden movements, but to use versions 4.0 or 3.5. And for those who have crooked hands, your problems. No need to provoke.

oleg-shilo pushed a commit that referenced this issue Feb 19, 2021
* Issue #971: Unable to build win latest nuget on net45
* Downgraded target runtime to v4.5.1. To improve compatibility
@oleg-shilo
Copy link
Owner

My apologies.

You can find the latest .NET v4.5.1 build on NuGet.
And of course you can always downgrade to the previous version.

Though I am not sure it was that sudden:

image

But I do agree the description was not explicit enough to draw the attention.

@tblong
Copy link

tblong commented Mar 1, 2021

I think the move from .NET v3.5->v4.x should have been cause for a major version bump in the WixSharp project.

@oleg-shilo
Copy link
Owner

I am not necessarily strongly opposing it but...
Normally the major version increase is reserved for "when you make incompatible API changes". Not the case here.
In fact there is no single API change that is associated with the change of the target runtime.

The same way as you may have Product vx.x.x that has two distros. One for one platform/runtime and another one for a different one.

@oleg-shilo
Copy link
Owner

Despite me questioning the need for increasing the WixSharp version I agree with Tyler that considering the version bump is a must when it comes to the migration on different runtime. The answer "to bump or not to bump" may be different in different situations but the consideration is a must.

Thus I am facing a very similar question for CS-Script (https://github.com/oleg-shilo/cs-script). I am about to release a new build that targets .NET5. Tough in this case the functionality of the product is dramatically changed because of the new features of .NET 5 so the version is getting increased v3.30.5 -> v4.0.0.0

@tblong
Copy link

tblong commented Mar 2, 2021

This does seem to be a bit of a grey area. I see this "when you make incompatible API changes" as a guideline and as such is not explicit enough of a description to cover all situations. When a downstream project updates to a minor build (e.g. WixSharp v1.14.8->v1.16.x), backward compatibility is expected. In this situation, the move to a higher .NET target has not ensured backward compatibility is maintained.

Example. My installer project is currently targeting .NET v3.5 with WixSharp v1.14.8. My project updates to WixSharp v1.16. Backward compatibility is expected however the build breaks due to the higher .NET requirement.

@HavenDV
Copy link
Contributor

HavenDV commented Mar 6, 2021

Small question:
Will I be able to run the Custom Actions installer on Windows XP (where only .Net 4.0 is available) after change TargetFramework to 4.5.1?

@oleg-shilo
Copy link
Owner

I would expect it to be OK. Both versions rely on the same CLR v2.
And you can also specify configFilePath (app.config) that will be used on target PC so you can define fallback strategy.

If none is specified WixSharp generates this one:

using (var writer = new IO.StreamWriter(configFile))
    writer.Write(@"<?xml version=""1.0"" encoding=""utf-8"" ?>
                                <configuration>
                                    <startup useLegacyV2RuntimeActivationPolicy=""true"">
                                        <supportedRuntime version=""v" + Environment.Version.ToNoRevisionString() + @"""/>
                                        <supportedRuntime version=""v4.0"" sku="".NETFramework,Version=v4.5""/>
                                        <supportedRuntime version=""v4.0"" sku="".NETFramework,Version=v4.0""/>
                                        <supportedRuntime version=""v2.0.50727""/>
                                        <supportedRuntime version=""v2.0.50215""/>
                                        <supportedRuntime version=""v1.1.4322""/>
                                    </startup>
                                </configuration>");
Compiler.TempFiles.Add(configFile);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants