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

NH-3990 - Upgrade to VS2017 project structure #605

Merged
merged 1 commit into from
Aug 5, 2017

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented Apr 25, 2017

No description provided.

@hazzik hazzik force-pushed the NH-3990 branch 2 times, most recently from bb37ad0 to d38b027 Compare April 25, 2017 08:42
@hazzik
Copy link
Member Author

hazzik commented Apr 25, 2017

Doesn't seem to be buildable on a build agent without installing full VS

@hazzik hazzik closed this Apr 25, 2017
@fredericDelaporte
Copy link
Member

The error in TeamCity does not let me think it needs a full VS. That looks like Antlr3 build is trying to use an old MsBuild dependency, and can no more find it when launched by the newest tools.

C:\Windows\system32\config\systemprofile\.nuget\packages\antlr3\3.5.1\build\Antlr3.targets(126,5): error MSB4062: The "Antlr3.Build.Tasks.AntlrClassGenerationTask" task could not be loaded from the assembly C:\Windows\system32\config\systemprofile\.nuget\packages\antlr3\3.5.1\build\.\AntlrBuildTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

It seems to fail because it has a dependency on the old Microsoft.Build.Utilities.v3.5. I do not think having a full VS would avoid that failure. Enabling .NET Framework 3.5 feature on windows is supposed to provide it. The build agent seems to have it. So it looks more like the new build command is unable to resolve all the required dependencies.

@hazzik
Copy link
Member Author

hazzik commented Apr 25, 2017

There are a few issues:

  1. BuildTools does not know how to build the Sdk projects and so there is "Microsoft.NET.Sdk is missing" error (Tracking: .NET Core Sdk in Build Tools Installer dotnet/msbuild#1697)
  2. If you specify MSBuildSDKsPath there is an error about VB projects saying that Restore task does not exist. (This way it does not build on my machine as well)
  3. If you put dotnet msbuild %* as suggested you get this Antlr3 error (which I get on my machine as well)

There is another workaround - to copy the Sdk folder from VS to BuildTools, but I don't want to do it.

So yes, it's not buildable in the current state without full VS

@fredericDelaporte
Copy link
Member

I have found this which looks related. If this is the root of our failure, we then have either to wait for the dotnet sdk to get fixed, or upgrade all build tasks for using newer msbuild, or avoid having parts to build with older msbuild.

I am not sure but I believe the only option we can do ourselves is the last, by reverting 9292e6e by example.

@hazzik
Copy link
Member Author

hazzik commented Apr 25, 2017

I've filed a bug: antlr/antlrcs#71

@hazzik hazzik reopened this Aug 2, 2017
@hazzik hazzik force-pushed the NH-3990 branch 9 times, most recently from af8e784 to 13bcd26 Compare August 3, 2017 05:58
Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting from Package Manager output on solution opening:

Error occurred while restoring NuGet packages: The operation failed as details for project NHibernate.TestDatabaseSetup could not be loaded.
Error occurred while restoring NuGet packages: The operation failed as details for project NHibernate.TestDatabaseSetup could not be loaded.
Restoring NuGet packages...
Time Elapsed: 00:00:02.3618731
========== Finished ==========

I have not found a reason for this. Some bugs in VS was reported with that error but they are supposed to be fixed in latest updates, which I have.

It does not prevent compiling from within VS.

The bat build menu is broken:

  • Option D is unable to find TestDatabaseSetup, it has moved to a net461 subfolder.
  • Option E, F, G & I fail building.
Error log removed, see Alexander answer for fix.

It seems that switching back to another branch requires to close VS, purge obj folders, then reopen the solution. Otherwise it fails compiling and VS still display the dependencies as if the project were migrated to new csproj format.

<ItemGroup>
<Reference Include="FirebirdSql.Data.FirebirdClient">
<HintPath>..\..\lib\teamcity\firebird\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference>
<Reference Include="Mono.Security">
<HintPath>..\..\lib\teamcity\postgresql\Mono.Security.dll</HintPath>
</Reference>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange addition, and missing file. Maybe a remnant from older Npgsql, no more needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, probably a rebate glitch

@hazzik
Copy link
Member Author

hazzik commented Aug 3, 2017

Yes, it requires either a clean checkout or purge of obj folders. Also it requires SDK2.0 Preview 2 and, possible, VS2017.3 Preview 6 (check without the VS first).

@hazzik
Copy link
Member Author

hazzik commented Aug 3, 2017

NHibernate.TestDatabaseSetup could not be loaded.

Probably because of Mono.Security

@fredericDelaporte
Copy link
Member

fredericDelaporte commented Aug 3, 2017

E, F, G & I builds fixed by the Core preview. (I have still the non preview VS2017.)

The Nuget difficulties for TestDatabaseSetup remains. Trying to build anything while Nuget struggles with TestDatabasSetup just fails, whatever the project. So it is a bit annoying, but well, not blocking either.
No, Mono.Security does not seem implied into this. I have tested that by removing it, that trouble is still there.

D still fails, if projects bin directories were cleaned before rebuilding with the new project format. (Otherwise it uses obsolete binaries from compilation with older project format.)

2.0 release is slated for Q3, so we will have to wait up to two months for the official release. Do you want to merge a dependency on a preview in master, or to wait for it to be released?

The new project format seems detrimental for VS load time of the solution. But without working with it and many branches, I cannot say if it will really be an annoyance. (And I still have R# enabled, which has also quite an impact on solution loading time.)

@hazzik
Copy link
Member Author

hazzik commented Aug 3, 2017

D still fails

I did not realize that it requires to have binaries built by VS to run tests. Weird.

Do you want to merge a dependency on a preview in master, or to wait for it to be released?

I want to merge, don't mind being dependent on preview. It's just a dev dependency, so does not matter much.

@hazzik
Copy link
Member Author

hazzik commented Aug 3, 2017

I've fixed "D" menu to the state as it was before this PR.

It requires to have Tools folder packages restored & binaries being built by VS. I think we shall tackle this in a separate PR.

@hazzik hazzik modified the milestone: 5.0 Aug 3, 2017
@fredericDelaporte
Copy link
Member

I did not realize that it requires to have binaries built by VS to run tests. Weird.

I was aware of this, and am using it for globally testing the last build I have done in VS. I was thinking this was made this way on purpose.

I want to merge, don't mind being dependent on preview. It's just an dev dependency, so does not matter.

Ok; Contributing.md should probably be updated for mentioning the build dependency on Core 2.0 (Preview or not indeed).

NHibernate.nunit Outdated
<assembly path="src\NHibernate.Test.VisualBasic\bin\Debug\NHibernate.Test.VisualBasic.dll" />
<assembly path="src\NHibernate.TestDatabaseSetup\bin\Debug\net461\NHibernate.TestDatabaseSetup.dll" />
<assembly path="src\NHibernate.Test\bin\Debug\net461\NHibernate.Test.dll" />
<assembly path="src\NHibernate.Test.VisualBasic\bin\Debug\net461\NHibernate.Test.VisualBasic.dll" />
Copy link
Member

@fredericDelaporte fredericDelaporte Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VB has not moved. It is still in NHibernate.Test.VisualBasic\bin\Debug\NHibernate.Test.VisualBasic.dll.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. VB has not been migrated to VS2017 format as it is supported only in VS2017.3

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@fredericDelaporte fredericDelaporte Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not knowing it would be supported for VB soon. I was not finding any info about vb support case, so was not expecting it at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, I saw somewhere on SO, but could not find the link now.

NHibernate.nunit Outdated
<assembly path="src\NHibernate.Test.VisualBasic\bin\Release\NHibernate.Test.VisualBasic.dll" />
<assembly path="src\NHibernate.TestDatabaseSetup\bin\Release\net461\NHibernate.TestDatabaseSetup.dll" />
<assembly path="src\NHibernate.Test\bin\Release\net461\NHibernate.Test.dll" />
<assembly path="src\NHibernate.Test.VisualBasic\bin\Release\net461\NHibernate.Test.VisualBasic.dll" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

- use dotnet to build solution
- fix typo in TestEmbeddedConfig.cfg.xml name
- fix extension of EntityWithFilters.hbm.xml
@hazzik hazzik merged commit ea51355 into nhibernate:master Aug 5, 2017
@hazzik hazzik added the r: Fixed label Aug 5, 2017
@hazzik hazzik deleted the NH-3990 branch August 6, 2017 22:54
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFramework>net461</TargetFramework>
Copy link
Contributor

@ngbrown ngbrown Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To output an .EXE, the following needs to be added:

    <OutputType>Exe</OutputType>
    <StartupObject>NHibernate.Tool.HbmXsd.Program</StartupObject>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created pull request #672

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

Successfully merging this pull request may close these issues.

3 participants