microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Question: The project needs to be deployed before we can debug

Open bryaan opened this issue 3 years ago • 27 comments

Im trying to build a WinUI3 project created with default templates. I created a WINUI3 class library and connected it to a Blank App. I am getting a dialog on build that says The project needs to be deployed before we can debug. Please enable Deploy in the Configuration Manager.

But when I go to Configuration Manager, the Blank App's Build and Deploy checkboxes are already checked. Deploy checkbox is disabled for the class library.

bryaan avatar Nov 24 '21 20:11 bryaan

@evelynwu-msft FYI

StephenLPeters avatar Feb 16 '22 22:02 StephenLPeters

I also encountered this problem, when I checked the Deploy option of the Project contexts in Configuration Manager, it was solved~ image

hongjiapeng avatar Jul 15 '22 07:07 hongjiapeng

I have the same problem although the checkbox is already cheched as you can see in the attached screenshot. Configuration manager

Jay-G-HK avatar Apr 22 '23 08:04 Jay-G-HK

OK, after testing further, this happens when my app directory is located on a local network drive mapped onto my PC. How to overcome this issue please ?

Jay-G-HK avatar Apr 22 '23 08:04 Jay-G-HK

On the other hand, if my app directory is on the local PC, it works fine.

Jay-G-HK avatar Apr 22 '23 08:04 Jay-G-HK

OK, after testing further, this happens when my app directory is located on a local network drive mapped onto my PC. How to overcome this issue please ?

@Jay-G-HK As you've discovered, packaged apps can't be run from a network drive.

evelynwu-msft avatar Apr 24 '23 22:04 evelynwu-msft

I can confirm this is an issue. My project was fine until the latest update of VS. Then it does not work. After starting a new maui project, I see the same issue. My guess is that a nuget conflict is causing it. My file is on C so no remote or removable.

Weird things I have seen.

deleting obj, .vs and bin folder can help, but not always.

I have

<WindowsPackageType>None</WindowsPackageType>
		<UseWinUI>true</UseWinUI>

	<ItemGroup>
		<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.2"/>
		<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
		<Manifest Include="$(ApplicationManifest)" />
	</ItemGroup>

without them I can deploy and run in release and debug from VS but can not run the .exe file

With them I can not deploy. Haha

If I first deploy and build and then add them, and build the build will fail due to deployment issue but .. now the app runs via the executable.

eschoker avatar May 09 '23 13:05 eschoker

@eschoker Setting <WindowsPackageType>None</WindowsPackageType> in your project file configures it as unpackaged which means that the Deploy action has no meaning. Make sure that in that particular scenario your launchSettings.json lists Project as the profile name if you wish to be able to F5 in VS.

evelynwu-msft avatar May 11 '23 01:05 evelynwu-msft

The same issue happens if you create your WinUI3 project on an encrypted drive - and then try to debug/launch it. Visual Studio shows error like this one: DEP0700: Registration of the app failed. [0x80070005] error 0x80070005: Opening file from location: AppxManifest.xml failed with error: Access is denied Simultaneously a "The project needs to be deployed before we can debug" dialog appears - and "Deploy" checkbox is selected.

Issue disappears after moving project directory to disk drive without encryption.

ouzieblo avatar Jul 06 '23 08:07 ouzieblo

In my case, the issue started happening after I renamed my .NET MAUI project even though the deploy checkbox was checked in the Configuration Manger.

What worked for me: Removing obj and bin folders

Thing I tried that didn't work: I tried many things including

  • restarting VS,
  • rebuilding the whole solution,
  • even changing the value of some settings on Configuration Manager and project properties to hopefully trigger a change and fix the issue

babak1199 avatar Aug 31 '23 06:08 babak1199

For me that was even more strange. In the end it was related to an invalid appxmanifest. The publisher was not following a certain pattern. No idea how that error should lead to that but this was the only fix I did.

TWiesendanger avatar Sep 08 '23 10:09 TWiesendanger

I recently faced the same issue and error message with a new MAUI project due to spaces in my project names. It's a simple and very stupid mistake, but nevertheless. For future reference, avoid spaces in project names.

IcEiE avatar Sep 17 '23 20:09 IcEiE

I had the exact same problem, but on a local drive that was encrypted using bitlocker. The solution was to decrypt the project folder.

mthurston-zl avatar Sep 19 '23 15:09 mthurston-zl

This message can show up when you have any sort of deployment error. Open the Output tab and set Show output from: to Build. Deployment errors will show up there, but not in the Error List tab or, as far as I can tell, anywhere else in Visual Studio. As an example, here's an error caused by a typo in an appxmanifest:

image

atom-b avatar Sep 29 '23 11:09 atom-b

I have the same problem although the checkbox is already cheched as you can see in the attached screenshot. Configuration manager

Jay, Under project properties/build output change the Platform Target to x64, and confirm that Build and Deploy are checked for x64. It worked for me. configuration

SriramChitturi avatar Oct 21 '23 22:10 SriramChitturi

Same issue here. I can't run my MAUI app from Visual Studio. However I noticed something interesting: I can run my MAUI .exe outside file outside Visual Studio despite the open issue https://github.com/dotnet/maui/issues/15067 On the other hand, the same code, on another pc, run under Visual Studio but not outside, as per open issue above. Not sure if this can help.

cargnel avatar Nov 09 '23 15:11 cargnel

Also running into this issue. Any word on a fix or workaround?

RuddyOne avatar Dec 01 '23 09:12 RuddyOne

Looking with interest at the comment @IcEiE regarding "Spaces in Project Names", my own related problem turned out to be "hyphens-in-project-names" which is something I've done routinely up to this point. Pascal-Case now seems to work fine.

IVSoftware avatar Dec 18 '23 14:12 IVSoftware

Not sure why this issue is still not resolved, i consider it pretty bad if an out-of-the-box generated project pops up this error. It is not very inviting to attempt write WinUI 3 apps this way if this is the first bug you run into. I tried many of the suggestions here but the error box keeps popping up in spite. I'll return to Win UI3 if the maturity is up to par.

vvoois avatar Dec 29 '23 14:12 vvoois

I had underscores in the project/solution name. Created a new project without the underscores and it worked.

NickA55 avatar Jan 06 '24 22:01 NickA55

I think it has to do with whether there is an internet connection or not when the program is created or when we first build the project.

athtse avatar Jan 07 '24 16:01 athtse

For me, this occurred when selecting .NET 8.0 LTS. Switched to .NET 7.0 Standard Service and the issue went away

ShadowDrakken avatar Jan 12 '24 21:01 ShadowDrakken

For me, this occurred when selecting .NET 8.0 LTS. Switched to .NET 7.0 Standard Service and the issue went away

Same problem here, and the only way that fix my problem is by switching to .NET 7.0.

aidrecabrera avatar Jan 20 '24 10:01 aidrecabrera

This fixed it for me:

get-appxpackage -name NameFromErrorMessage -AllUsers remove-appxpackage -package PackageFullName -AllUsers

https://learn.microsoft.com/en-us/answers/questions/1387776/maui-another-user-has-already-installed-an-unpacka

angrynik avatar Jan 31 '24 03:01 angrynik

I had underscores in the project/solution name. Created a new project without the underscores and it worked.

This worked for me. I had spaces in a project name (e.g. "Project Name Here") and it resulted in this error. Removing the spaces eliminated the error.

William-Scharmach avatar Feb 22 '24 01:02 William-Scharmach

I tried a number of the solutions described here. The only thing that allowed the Windows version to deploy and debug was to recreate the project using a project name that included no spaces in it.

SpectrumJobs avatar Mar 08 '24 17:03 SpectrumJobs