2

I'm attempting to set up a Continuous Integration process for a legacy VB.Net ASP.Net Forms application, using Visual Studio 2015 and an on premises TFS 2013 server. However, I'm struggling to get a Build Definition to successfully build my application.

The build fails with the following errors.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets (182): Could not copy the file "appSettings.config" because it was not found.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets (182): Could not copy the file "connectionStrings.config" because it was not found.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets (182): Could not copy the file "globalization.config" because it was not found.

The three files mentioned appSettings.config, connectionStrings.config and globalization.config are all configSource config files (external config files that web.config references) that I don't want to use as part of my CI MSBuild (I'm hoping to use a transform on the CI system web.config to swap in the necessary settings).

Their properties are marked as Build Action: Content and Copy to output directory: Do not copy. Are these file properties correct to tell MSBuild to ignore them? I tried switching to Build Action: None with no success.

Do I need to add extra configuration to my project file or MSBuild settings to get it to just ignore them?

Ted
  • 2,525
  • 2
  • 37
  • 54
  • Are you "publishing" the website as part of your build for the asp.net application? – granadaCoder Mar 20 '17 at 20:29
  • I want to Publish it to an Azure Web app once it's built, but as this error is preventing the build itself I've not got as far as configuring that yet. – Ted Mar 20 '17 at 20:37
  • Have you gave a try if it works with your local msbuild instead through TFS build? – PatrickLu-MSFT Mar 21 '17 at 09:36
  • That seems to work fine Patrick (I simply ran `msbuild myProj.vbProj > testOutput.txt` and the project rebuilt with no errors) – Ted Mar 21 '17 at 09:59

1 Answers1

0

After test with Build Action: Content and Copy to output directory: Do not copy. This is also work fine with my local MSbuild in VS.

So your issue is related to your TFS XAML build definition. Clearly those xx.config files are not in the path that TFS expects. XAML build is actually also call MSBuild to perform the build.

For narrow down the issue, one way is comparing the difference in the logs of your XAML build and local MSBuild with some parameter such as both build proj file. And then modify your build definition.

Another way is add a custom workflow activity to your build process template to accomplish this, please refer to TFS Build not transforming web.config as expected. And in XAML build definition, you could also run script file(or another way) to modify the project(working directory) to using correct .Config file before project be built during TFS Build.

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62