OfficeDev / Office-Add-in-samples

Code samples for Office Add-in development on the Microsoft 365 platform.
MIT License
709 stars 783 forks source link

Debug error with ASP.NET React sample #64

Closed Buzzardbait closed 3 years ago

Buzzardbait commented 4 years ago

Note: This repo is only for questions related to its samples. If you have questions about how to use office.js or the Office developer platform, please post your question on https://stackoverflow.com. Tag your question with office-js or outlook-web-addins

Question

I downloaded the sample and followed the instructions but something went wrong. Excel can't see the add-in. I named the project React1 Here are various steps... React1 Warnings: 3> npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1 3> npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. 3> npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 3> npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart() \Office.ASP.NETCoreReactAddins\excel-js\ClientApp\node_modules\webpack-dev-server\node_modules\fsevents\node_modules\yallist' -> 'C:\vba\PnP-OfficeAddins-master\Samples\Office.ASP.NETCoreReactAddins\excel-js\ClientApp\node_modules\webpack-dev-server\node_modules\fsevents\node_modules.yallist.DELETE' 3> 3> added 1644 packages from 846 contributors and audited 919705 packages in 410.089s 3> found 0 vulnerabilities 3> 3>Target CleanupEmptyRefsFolder: 3> Directory "C:\vba\PnP-OfficeAddins-master\Samples\Office.ASP.NETCoreReactAddins\excel-js\bin\Debug\netcoreapp2.2\refs" doesn't exist. Skipping. 3> 3>Build succeeded. 3> 0 Warning(s) 3> 0 Error(s) 3> 3>Time Elapsed 00:07:17.54 ========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== Note: Warnings seem to have been resolved. Step 7: Properties/Application/Assembly name: = React1 (there is no Web Project property) Note: only .NET 4.5.2 through 4.8 are available. This doesn't look right. What happened to Net Core 2.2 Runtime (individual component)?

Step 8. In the Solution Explorer opened the manifest.xml file under the Office Add-in project (the project only contains a manifest file). Copy and save the that has the GUID for your project. Note: What to do with it?

6e00caac-8450-4ca5-b019-b5c6ac08cafa

Step 9. Copied the contents of the manifest.xml file in the ASP .NET Core project and replaced all of the contents in the manifest file in the Web Add-in project (i.e. React1-Manifest.xml) with it. Debug: Upon Excel Launch: ADD-IN Error: A problem occurred while trying to reach add-in.

My solution & project locations look like this: ASP.NET Core_React_JavaScript.csproj C:...\PnP-OfficeAddins-master\Samples\OfficeASP.NETCoreReactAddins\excel-js\ASP.NET_Core_React_Javascript.csproj React1.sln C:\Users\Martin\source\repos\React1

I have ASP.NET Core 2.2 loaded as an extension. It bothers me that it doesn't show up as a selection in the properties/application/frameworks. Also, could there be an issue with the Web Project property? Don't see it anywhere. Thanks

davidchesnut commented 4 years ago

Hi @Buzzardbait , Yeah, the steps are a little confusing so I will fix that. The reason to copy the ID is so that you can paste it back in once you replace your manifest with the one from the template. You don't want to use the template ID because on additional projects you'll end up with multiple add-ins attempting to use the same ID which would cause issues. I'll add a step on how to paste it back in (which is missing).

You want to set the web project property to ASP.NET_Core_React_JavaScript which is the new project you added. That project uses ASP.NET Core 2.2. You'll no longer use the original web project the wizard built which is still on .NET ~4.7 or so.

Trying to run through the steps myself I am now getting some sort of runtime issue and the task pane won't load properly. I'm checking with the product team and will follow up once I have more info there.

Thanks! David

davidchesnut commented 4 years ago

Hi @Buzzardbait I have a PR pending that fixes the dependencies which was causing the add-in not to load and run properly. Also I added some images and steps to the readme to make it clearer. Would be great if you could try it and let us know if it works. Thanks!