Skip to content

Set Up Visual Studio for FieldWorks Development on Windows

Mark Kidder edited this page May 31, 2023 · 26 revisions

$FWROOT in the text below simply stands for the root directory of the FieldWorks source tree.

Install Visual Studio

  1. Download and install Visual Studio 2022 Community
    • Go to https://visualstudio.microsoft.com/vs/older-downloads/
    • If 2022 is the latest then click Download and select Community 2022. If 2022 is not the latest then expand 2022 and click Download. (you will need to create an account and agree to receive junk mail)
    • Run the installer
    • If you see an ‘Installed’ and ‘Available’ Tab then on the Available tab, install Visual Studio Community 2022 (If you do not have other versions of Visual Studio installed then this step does not appear to be needed.)
  2. During installation select
    • Workloads:
      • '.NET desktop development'
      • 'Desktop development with C++'
    • Individual Components:
      • 'Windows Universal CRT SDK'
      • 'Windows Universal C Runtime' options.
      • .NET Framework 4.6.1 SDK
      • .NET Framework 4.6.1 targeting pack

Using shared settings for ReSharper

If you have ReSharper installed this description assumes that it is version 6.1. You can download ReSharper from the Visual Studio Gallery: Open Visual Studio and choose Extensions > Manage Extensions; then, click Online in the left navigation pane and search for ReSharper. ReSharper requires a license.

You'll find a R# settings file in $FWROOT\FW.sln.DotSettings. If you save your solution in VS as $FWROOT\FW.sln the shared settings will automatically be picked up.

Alternatively you can copy the file and give it the same name as your solution with an extension of .sln.DotSettings.

Or you can import the settings (select "Resharper/Manage Options", Import/Export Settings/Import from file).

However, the first option has the advantage that ReSharper will pick up any changes that might be made to the shared settings file.

Set "Keep tabs" in Visual Studio Text Editor

Tools->Options Text Editor->All Languages->Tabs Select the "Keep tabs" radio option. (Tab size & indent size should both be 4)

Create a solution to run FieldWorks

Open C:\fwrepo\fw\Src\Common\FieldWorks\FieldWorks.csproj in Visual Studio, and add existing projects to the solution. You will probably want the following, along with their associated Tests projects:

  • C:\fwrepo\fw\Src\Common\FwUtils\FwUtils.csproj
  • C:\fwrepo\fw\Src\Common\FwUtils\FwUtilsTests\FwUtilsTests.csproj
  • C:\fwrepo\fw\Src\Common\Controls\FwControls\FwControls.csproj
  • C:\fwrepo\fw\Src\Common\ViewsInterfaces\ViewsInterfaces.csproj
  • C:\fwrepo\fw\Src\Common\Controls\Widgets\Widgets.csproj
  • C:\fwrepo\fw\Src\FwCoreDlgs\FwCoreDlgControls\FwCoreDlgControls.csproj
  • C:\fwrepo\fw\Src\FwCoreDlgs\FwCoreDlgs.csproj
  • C:\fwrepo\fw\Src\XCore\xCore.csproj
  • C:\fwrepo\fw\Src\XCore\xCoreInterfaces\xCoreInterfaces.csproj
  • Any projects and dependencies you are working on, along with their Tests

Unfortunately, Visual Studio does not run well with all of our projects loaded, and will therefore be unable to successfully build your solution. You will need to build from the command line (see the Building FieldWorks wiki page) or add the build script to your External Tools in Visual Studio.

Add Build to External Tools (optional)

Click Tools -> External Tools... Click Add.

Title: Build FW RemakeFW
Command: \fwrepo\fw\Build\build.bat
Arguments: /t:remakefw
Initial directory: \fwrepo\fw\Build

Select "Use Output window".

Click Add.

Title: Build FW All
Command: \fwrepo\fw\Build\build.bat
Arguments: /t:mkall
Initial directory: \fwrepo\fw\Build

Select "Use Output window".

Click Add.

Title: Build FW Current Project
Command: \fwrepo\fw\Build\build.bat
Arguments: 
Initial directory: $(ProjectDir)

Select "Use Output window".

You can also add /property:action=test to your External Tools, if you desire.

Notes

The FileUpdate task in MSBuild.Community.Tasks.dll, in FW 8.3 branches, may require .NET 2.0.

To get .NET 2.0, do the following:

  1. Launch ‘Turn Windows features on or off’.
  2. Select “.NET Framework 3.5 (includes .NET 2.0 and 3.0)” and click OK.
Clone this wiki locally