Msbuild 1 ошибка msb1009

I am very new to MSBuild environment and while trying to build one of the application that I am working on, I am following some instructions. By following the instructions written in the application documentation, I was able to build a command which looks like below:

msbuild /t:Harvest;WIX setup.build;  /P:publish_location="C:Installer";product_file="C:TempServiceHost.dll";product_id="1.0"

But when I run the command, it throws following error:

MSBUILD : error MSB1009: Project file does not exist.

Which raises a lot of questions:

  1. There is no parameter named Project here. I am not sure why it is failing on that particular parameter?
  2. what does «/t:Harvest;WIX» mean?
  3. Normally msbuild command refers to .sln or .csproj file but the documentation that I am referring to particularly wants me to refer to .Dll file so I did. Am I right in doing so?
  4. How can I solve this error?

Just for reference below is the documentation that I am referring to:

This solution is only includes an installer. In order to create an
MSI with this solution by hand, you need to bring up a visual studio
command prompt, navigate to the setup.build location of the Installer
project and type the following command: (where the publish location is
replaced by the current publish location, product_id is replaced with
current product_id, and product_file is the file you want to pull the
version from) msbuild /t:Harvest;WIX setup.build
/p:publish_location=»location»;product_file=»Matchbox.Management.ServiceHost.dll»;product_id=»xxxxxxxxxxxx»

asked Feb 17, 2017 at 19:02

Lost's user avatar

2

From the MSBuild Command Line Reference:

MSBuild.exe [Switches] [ProjectFile]

So setup.build is your project file (which it seems cannot be found).

/target:targets

Builds these targets in this project. Use a semicolon or a comma to separate multiple targets, or specify each target separately. /t is also acceptable.

so

/t:Harvest;WIX

means you are building targets Harvest and WIX which should be defined in your project file.

/property:name=value

Sets or overrides these project-level properties, where name is the property name and value is the property value. Use a semicolon or a comma to separate multiple properties, or specify each property separately. /p is also acceptable.

so

/P:publish_location="C:Installer";product_file="C:TempServiceHost.dll";product_id="1.0"

simply defines three properties which can be used for any purpose in your MsBuild project. So we cannot tell whether you are right in doing so. But it seems to be according to your documentation.

answered Feb 17, 2017 at 19:43

wkl's user avatar

wklwkl

1,8962 gold badges15 silver badges26 bronze badges

Error MSB1009: Project file does not exist is no longer a problem with this handy solution by our Support Techs.

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped out a customer with the error MSB1009: Project file does not exist.

How to resolve error MSB1009: Project file does not exist

Have you been facing the following messages recently?

MSBUILD: error MSB1009: Project file does not exist.

Switch: ProjectName.csproj

ERROR: Service 'ServiceName' failed to build: The command '/bin/sh -c dotnet restore "ProjectName.csproj"' returned a non-zero code: 1

Fortunately, our Support Techs have a solution up their sleeves. After helping several customers with a similar issue, our Support Team recommends ensuring the Dockerfile is in the root of the project. Furthermore, we have to modify the settings in the docker-compose.yml file as shown below:

FROM mcr.microsoft.com/dotnet/core/runtime:2.2-stretch-slim AS base

WORKDIR /app

EXPOSE PortNumberOpenedOnDatabaseServer


FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build

WORKDIR /src

COPY ["ProjectName.csproj", "ProjectName/"]

RUN dotnet restore "./ProjectName.csproj"

COPY . .

WORKDIR "/src/."

RUN dotnet build "ProjectName.csproj" -c Release -o /app/build



FROM build AS publish

RUN dotnet publish "ProjectName.csproj" -c Release -o /app/publish



FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "ProjectName.dll"]

Here, we will build the Docker Image via the sudo docker-compose build command. We can also build and run the container at the same time by running sudo docker-compose up in the folder where docker-compose.yml is present.

According to our Support Techs, the docker-compose.yml should include the correct path for this to work seamlessly and hence no longer see this error message

MSB1009: Project file does not exist

When we avoid pruning images or docker containers no longer in use, the second command for building images will fail. In other words, we have to clean the Docker System with the following command:

sudo docker system prune -a

Furthermore, we can verify this with the sudo docker images command and then proceed with the sudo docker-compose build command to build images. Once we get this doen, we will not come across the MSB1009 error message.

[Looking for a solution to another query? We are just a click away.]

Conclusion

In short, the skilled Support Engineers at Bobcares demonstrated how to resolve the Project file does not exist error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

  • Remove From My Forums
  • Question

  • Hi

    I get above error when trying to build msi using BTDF

    Christiane

    • Edited by

      Friday, June 5, 2015 5:15 PM

Answers

  • Hi,

    Check the spelling of the file name and path. Give the correct names if wrongly given.

    Ravi

    • Marked as answer by
      Christiane0696
      Monday, June 8, 2015 1:23 PM

  • The probable cause of this issue could be that the project
    file does not exist in the specified directory or, if no directory was specified, the project file does not exist in the current working directory. As suggested already you have to check the spelling of the file name and path.

    Rachit


    Please mark as answer or vote as helpful if my reply does

    • Marked as answer by
      Christiane0696
      Monday, June 8, 2015 1:23 PM

I am using below Task and running this from VS Code.

  Task("Build")
   .Does(() =>
      {
        // Use MSBuild 
       MSBuild("E:/Repos/Code/TestService/TestWindowsService.sln", settings =>
    settings.SetConfiguration(configuration));

    });

But I am getting below error when I Was try to run this Script.

MSBUILD: error MSB1009: Project file does not exist.
Switch: E:/Repos/Code/Cake/Code/TestService/TestWindowsService.sln
An error occurred when executing task ‘Build’.
Error: One or more errors occurred.
MSBuild: Process returned an error (exit code 1).

asked Dec 7, 2018 at 13:03

Pancheti's user avatar

4

Load 7 more related questions

Show fewer related questions

CMake Discourse

Loading

Понравилась статья? Поделить с друзьями:
  • Msb8020 c v142 ошибка
  • Msasn1 dll ошибка
  • Msado15 dll как исправить ошибку
  • Ms668 ошибка e10
  • Ms668 курок ошибки