Azure build pipeline not generating bin folder - c#

I have aspnet MVC 5 solution which is containing several project, i need to publish the main project using azure CI and CD so i configured azure build pipeline (see the attachment for configuration). but when the artifacts are generated i noticed that there is no bin folder with deployment files. what could be the possible reasons for this behavior?
This is the generated artifact
This is Solution Configuration task
This is the publish path
This is publish artifact configuration task
This is link for the logs of the pipeline
This is The error when i chose the solution instead of csproj
This is after chaining to SLN or set AnyCPU

what could be the possible reasons for this behavior?
According to the images you provided, I could reproduce this issue if I select the project file .csproj instead of solution file .sln in the Visual Studio build task:
That because if we select the project file .csproj, there is a warning when we build the project:
Warning : The OutputPath property is not set for project 'ASP.NETMVC.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='release' Platform='any cpu'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.
Although the result of the task is passed, the output is not output correctly due to the above warning.
That the reason why you build is successfully, but bin folder is not generated.
To resolve this issue, we select the solution file in the Visual Studio Build task:
Then the warning disappeared, and bin folder is generated:
Update:
when i select the solution instead of the csproj i got errors related
to the unsuccessful builds due to some missing references.
That because you just restore the one of packages.config file in the nuget restore task. You need to change it to the .sln file instead of packages.config file.
Besides, to resolve your previous issue, we could choose the .sln file instead of the project file (I answered before.). Or you could change the default variable BuildPlatform from any cpu to AnyCPU (move the space).
Hope this helps.

Related

Specify which project or solution file to use because this folder contains more than one project or solution file

I just switched to Ubuntu & Rider from Windows and VS 22 and I'm having a hard time running "update-database" like I was in VS 22.
I tried doing it using Dotnet CLI. I went into the root folder of my project, then I did:
dotnet ef database update
and I got
Specify which project file to use because this '/home/octavian/RiderProjects/mediere-api' contains more than one project file.
I tried running
dotnet restore
and I get the same.
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
When I do a ls -a, here's what I get:
. appsettings.json DataLayer docker-compose.yml .dockerignore .gitignore Mappers Migrations Program.cs
.. bin docker-compose.dcproj Dockerfile Dtos Helpers mediere-API.csproj obj Properties
appsettings.Development.json Controllers docker-compose.override.yml Dockerfile.original .git .idea mediere-API.sln Processors Requests
I don't know why I'm getting this error because I only have one .csproj file.
What can I do to fix it?
Is there any chance that I didn't install all the requirements?
I only installed this after installing Rider
https://dotnet.microsoft.com/en-us/download#linuxubuntu
Thanks.

Restore NuGet packages failed for project ... : Could not find a part of the path

I'm trying to run a Unit Test project in Visual Studio (.NET Framework 4.72).
The project is now building/running successfully, however there is still an error that the NuGet packages can't be restored (the file path is actually wrong and does not exist.). How can I change to the right file path and tell VS to not look in the wrong path?
Here's the error:
NuGet Package restore failed for project Tests_WeatherData: Could not find a part of the path 'C:......\Begin\packages\MSTest.TestAdapter.1.3.2\build/_common/zh-Hans/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll'
Thank you for any advice how to change the file path/restoring settings.
It can be caused by having your project located within a subfolder that is too deeply nested. I think possibly there's some limit for the folder path like maybe 250 characters or something like that.
I saw the same error when I downloaded a zip with some demo projects and when I unzipped it created a folder with many subfolders. The project I was interested in was down pretty deep in the subfolders and when I tried to restore its NuGet packages I got the same errors.
I moved the project folder up nearer to c:\ and then the restore errors went away.
This is what worked for me.
Download nuget.exe from here.
Copy this nuget.exe executable to the folder that contains the solution which is currently failing to build.
Ensure that the LongPathsEnabled registry key is set to 1.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
Open cmd prompt, navigate to the above folder location. Run the below command.
c:\repos\MySolutionFolder>nuget.exe restore
Build the solution in Visual Studio. In my case I used VS2019.
Link that helped me with these steps - Github-Issue.
The issue could be filepaths in your CSPROJ file. Most common cause is project restructure and the location of packages has changed.
In addition to NUGET references in the CSPROJ, there could be a few other spots in the footer of the CSPROJ or the header portion for MSTest adapter entries. I.e. just verify all your filepaths (especially relative) ones are all correct and reload/rebuild.

How do I force Visual Studio 2019 to generate a .deploy file for an icon for ClickOnce deployment/install

I'm running into a problem publishing/installing a ClickOnce application being built in C# in Visual Studio 2019. The application is being built using .NET Core 3.1 and WPF.
I have an icon I am using for the application that is included in the project with the filename "loader.ico". The ClickOnce manifest is calling out for loader.ico, but the required Loader.ico.deploy file is not being generated when publishing, which is throwing an exception when trying to run the setup.exe to install the application to a client PC (actual filepaths have been replaced with [Path]:
+ Downloading file:///[Path]/x64/ClickOnce/Application Files/.NET Bootloader_1_0_0_4/loader.ico.deploy did not succeed.
+ Could not find file '[Path]\x64\ClickOnce\Application Files\.NET Bootloader_1_0_0_4\loader.ico.deploy'.
I have attempted a few things using what information on the problem I could find:
I set the Build Action for loader.ico to Content and set Copy to Output Directory to Copy Always. I also set the "Settings>Application Files" setting for loader.ico to Include. This has no effect on the resulting Publish, and no loader.ico.deploy file is generated.
I also receive the following in the output window when publishing:
Unable to apply publish properties for item "loader.ico"
I have also tried excluding loader.ico from the "Application Files", but this does not remove the reference in the .manifest file.
So now I am at a bit of a loss. I don't know why it would demand a .deploy file for the icon (I'd think it would just be embedded? No need for a separate icon file?). I can't seem to get the ClickOnce publishing process to generate the required loader.ico.deploy file, and I can't seem to get the manifest to remove the reference to it. What settings could be used to force the generation of this .deploy file (or force the manifest to not reference it)?
I had the same problem your application .ico file causes this error so you have to change its properties setting to Build Action: Content and Copy To Output Directory: Copy always.
hope it works
I can confirm from my very own experience how frustrating this is. I have tried anything and everything.
For the time being - until this issue is sorted - I am suggesting that you manually add the .ico file to the Apllication_1_0_0_x folder and appending '.deploy' at the very end.
So file will look like 'my-icon.ico.deploy'.
It works. Tried and tested.
In my case it helped:
Publish -> Show all (Settings current project) -> Settings -> Application Files -> (Show all files):
Find ico file, select publish status to Include | (Required) | Include.
From now on, the ICO file will be added when publishing
Additionally to the icon loading problem that I initially "solved" with Avrohom's method, I faced some issue with WebView2 not working / being loaded.
Both of these problems stopped when I disabled the click once publishing profile (.pubxml) option for producing a single EXE file:
<PublishSingleFile>False</PublishSingleFile>
Tested with .NET6, Visual Studio 2022

.NET CLI : dotnet pack command is not working in correct folder and when .csproj exists

I need to create a NuGet package from one of my projects. So I have the following command in my code.
CommandUtility.runCommand($"cd {templateGitPath} && mkdir nupkgs");
CommandUtility.runCommand("dotnet pack --no-build --output nupkgs");
But it returns the following error although I have a .csproj file and I'm running the command in the right project folder.
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
How can I fix this?
[UPDATE]
NuGet package has created in bin/Debug folder. But could find why it's not get created inside the nupkgs folder.
The issue was with the location as the #viveknuna has mentioned. If you get this kind of error probably check for the .csproj file or the location.
I think the current directory where you are running this command does not have .csproj file.Add the .csproj file and then try to run command again

Output location of project

I was looking for the output of a project as a *.dll file to add it in References, but in bin folder there where Release and Debug folders.
Is there any difrence between the output.dlls?
Where is the useable output?
please explain the folders roles.
The folders correspond to your Solution Configurations, e.g. Debug or Release. You can specify custom configurations as well, and a folder would be created for it.
Instead of referencing the .DLL file directly by browsing to it, you should reference the project that defines the .DLL. If the project is not in your solution, you can add it by right-clicking on the solution title in the Solution Explorer and choose "Add" > "Existing project...".
This will allow Visual Studio to rebuild the .DLL in case you make changes, which you can now make without leaving your other project, and automatically reference the correct version, and also reference the configuration matching your project, i.e. if your project is run in Release, it will also use the release version of the .DLL.

Categories

Resources