Andre Silva
Andre Silva

Reputation: 145

Azure pipeline build fails with VS linked files

I have a project in VS2019 that has a linked file from another project, they are not in the same solution, I just need to have that one file synced between the projects, think this is the best way, please correct me if I'm wrong. Is there a way of having azure pipeline build successfully and have that file synced?

Tried by copying the file and it worked, but when linked doesn't.

Expected it to somehow copy the file when the file changes, but it doesn't happen.

It doesn't find the file,

CSC : error CS2001: Source file 'Linked File Path' could not be found. [Project Path]
    0 Warning(s)
    1 Error(s)

Update

I'm using Git

Upvotes: 1

Views: 434

Answers (1)

ΩmegaMan
ΩmegaMan

Reputation: 31721

A linked file outside the solution is a file which the build operation cannot pull during a clean build. This file, while properly linked in the project has the affect of being an external dependency.

One course of action is to do a pre-build step to get the file from Git in some fashion to the location the link points to.

Otherwise you will need to find a different way to store the file within your solution. Such as a prebuild step to copy the file into a location such as a solution folder during a build step (and checked in later...). This file would then be checked in to the current solution and pulled down during the azure build.


The purpose of linking a file is a good one and I have used it, but this is now like an external dll which you are not pulling in using Nuget. You need to get this file into the project either by it being a file, or somehow compiling that file into a linkable assembly to be copied into an external assemblies folder that can be built with the project/solution.

Upvotes: 1

Related Questions