Visual studio export template replaces original projectname with $safeprojectname$ - visual-studio-2012

My project is a mvc4 project in visual studio 2013 ultimate.
I tryd to send my project by following the steps :
File > Export template > (leave all the options as default)
I get a zip that i unpack. If i open the unpacked solution and run the program i get alot of errors. It looks like visual studio replaced all the text that contained the projectname with $safeprojectname$. How can i export the project without visual studio replacing all the 'projectname' spots so that i can run my program.
I tryed creating a new project (console application) with no code in it, if i export it and import it i get the same message first i get :
Warning 1 Load of property 'RootNamespace' failed. The string for the root namespace must be a valid identifier. SvenEind
and after running i get
190 errors 31 warnings
I tryd importing http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/building-the-ef5-mvc4-chapter-downloads and that worked for me.
So i guess the problem is in some kind of settings for exporting files.

replaced all the text that contained the projectname with $safeprojectname$
This is very much by design. You created a project template, a cookie-cutter for new projects. You are not supposed to do anything with the .zip archive. It should sit patiently in your "My Exported Templates" folder. Until the day arrives that you want to start a new project.
You then can pick the template instead of using one of the built-in ones that were preinstalled by the Visual Studio installer. Visual Studio prompts you for the project name. It then unzips the archive, copying the files into your new project directory. And modifies the files, $safeprojectname$ is substituted by the new project name you entered. You now have a good start for your new project, using the settings and assets that you saved earlier when you created the template.
Sounds like you had an entirely different use in mind, I can't guess at the intention from the question.

Hmmm. I got this error on Build:
The app manifest must be valid as per schema: Line 42, Column 18, Reason: '$safeprojectname$' violates pattern constraint of '([A-Za-z][A-Za-z0-9]*)(\.[A-Za-z][A-Za-z0-9]*)*'. The attribute 'Id' with value '$safeprojectname$' failed to parse.
So I grabbed the project name from the VS Configuration Manger and put it in the app manifest like this.
<Applications>
<Application
Id="CordovaApp.Windows10"
And the error went away and the project built. HTH.

Related

Gradle build failed with new import rules

I met an error after I updated android studio to version 3.6. When I tried to import Scenceform asset, it shows a warning in the picture below, whatever I click, it will return
java.lang.RuntimeException: java.lang.NoSuchMethodError: com.android.tools.idea.templates.recipe.RecipeExecutor.append(Ljava/io/File;Ljava/io/File;)
How can I fix this?
-- Update June 2020 --
Sceneform 1.15 has been replaced by the open source Sceneform 1.16. This appears to have also changed the model build approach, no longer using the SceneForm plugin and .sfa/.sfb workflow and instead including direct support for .gltf format model.
More information is available on the GitHub page, although the respoitory has now been archived which makes it hard to understand the future direction for Sceneform at this time (June 2020):
(https://github.com/google-ar/sceneform-android-sdk)
-- Workaround to the original problem if you are using Sceneform 1.15 --
To workaround the issue is you are using the Sceneform Plugin - see below:
This appears to be an issue with Android Studio 3.6 at the time of writing - see the issue here:
https://github.com/google-ar/sceneform-android-sdk/issues/912
One workaround appears to be to revert to Android Studio 3.5.
Alternatively adding the asset manually appears to work - taking the example in the online documentation for ARCore (https://developers.google.com/ar/develop/java/sceneform):
Follow these steps to import a new 3D asset:
Verify that your project's app folder contains a sampledata folder.
To create the folder, right-click on the app folder in the Project window, then select New > Sample Data Directory.
The sampledata folder is part of your Android Studio project, but its contents will not be included in your APK.
Copy your 3D model source asset file (*.obj, *.fbx, or .gltf), and all of its dependencies (.mtl, *.bin, *.png, *.jpg, etc.) into the sampledata folder.
Do not copy these source files into your project's assets or res folder, as this will cause them to be included in your APK unnecessarily.
Now instead of right clicking and using import, as the instructions at the link above go on to say, add the following lines to the bottom of your build.gradle(app) file manually:
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/andy.obj', // 'Source Asset Path' specified during import.
'default', // 'Material Path' specified during import.
'sampledata/andy.sfa', // '.sfa Output Path' specified during import.
'src/main/res/raw/andy') // '.sfb Output Path' specified during import.
Rebuild your project and the renderable should be imported correctly - check that andy.sfb has appeared in the 'res/raw' folder to be sure.
#harsha make sure the .obj file is referring to the right material.
mtllib chroma_key_video.mtl
g default
v -0.000000 2.244259 0.431967
v ...

Error: A namespace cannot directly contain members such as fields EntityFramework.dll' could not be found

enter image description hereI want to create model: add > class > ado.net entity, for my db first project and also want to create CRUD operation by asp.netscaffolding, but failed to create a model with necessary code.and thus i failed to create scaffolding .
in my model file AllahHelp.Context.cs, there is no code, only the text "ErrorGeneratingOutput".
Error 1:
A namespace cannot directly contain members such as fields or methods F:\project\WebApplication8\WebApplication8\Models\AllahHelp.Context.cs 1 1 WebApplication8
Error 2:
Compiling transformation: Metadata file 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools..\IDE\EntityFramework.dll' could not be found F:\project\WebApplication8\WebApplication8\Models\AllahHelp.tt 1 1 WebApplication8
If there is an error transforming your .tt files into class files, your class files will just have "ErrorGeneratingOutput" in the source file, which causes a "namespace cannot directly contain members such as fields" error, but doesn't really have anything to do with that.
Your actual error sounds like you're missing a reference to EntityFramework.dll. Right click the project, choose "Manage NuGet Packages..." and find and install EntityFramework to your project.
In some situations I've also run into a problem where since the transformation occurs before files are copied, referenced dlls don't ever get copied since the error occurs and stops the process. In this case you would need to remove the model from your project temporarily, successfully compile the project, and then add the model back.
According to this similar question it could also be because of your install path. If that is your issue, try to find where the dll is, and correct the environment variable VS120COMNTOOLS (Control Panel -> System -> Advanced System Settings -> Environment Variables -> System Variables)
(Be careful changing system variables, though.)
I was getting this error when attempting to build a project using .tt templates. I fixed the issue by checking everywhere that I used C# code injection and making sure that I closed each section of C# code by including #>.
Example:
Problematic code:
{
"find": "__LOCATION__",
"replaceWith": "<#= deployment.Location"
},
Fixed code:
{
"find": "__LOCATION__",
"replaceWith": "<#= deployment.Location #>"
},

Microsoft.VisualStudio.SharePoint.targets(418,7): error MSB4131: The "IsDebugging" parameter is not supported

I'm using Visual Studio 2012 to build a empty SharePoint 2013 project (added a test list). However when I try to deploy the project I receive the following:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets(418,7): error MSB4131: The "IsDebugging" parameter is not supported by the "SetPackagingProperties" task. Verify the parameter exists on the task, and it is a gettable public instance property.
I've tried commenting out various lines but it just leads to more problems. Furthermore it then does not package the solution.
The setPackagingProperties task, as documented here http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.sharepoint.tasks.setpackagingproperties.aspx, indeed does not include a IsDebugging property. Therefore is the file C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets incorrect? I'm using SharePoint Found Server 2013.
Thanks for any help - this one is doing my head in!
Turns out that the solution was simple: a conflict of DLLs.
To anyone else with the same problem:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.Tasks.dll DOES contain the IsDebugging property (undocumented!). My problem was that I had VS 2010 installed with the SP developer tools. This meant that VS 2012 was referencing the incorrect DLL version of Microsoft.VisualStudio.Sharepoint.Tasks.dll. My solution was simple to therefore search the entire system for this DLL and delete all copies apart from the one referenced in the path above.
Pareto's ratio: 80% of time wasted is attributable to just 20% of problems encountered, like this one!!!

publishing MVC 4 app exception.., The specified path, file name, or both are too long

I am attempting to publish a website, using the file system method. I used this method with visual studio 2010 and I didn't run into to many problems. But I recieved the above error when trying in visual studio 2012. The full error is bellow...
Error : Copying file Service References\ACOServiceReference\FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource to obj\Release\Package\PackageTmp\Service References\ACOServiceReference\FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource failed. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
What am I missing or doing wrong? Obviously a file path is too long, but is there a way I can create like path variables or something to shorten the path names? How can I set that up?
No you can't shorten it as Windows will use the fully qualified name (C:\aaa\aaa...).
Two solutions:
Shorten your namespace (FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource)
Change the location of your project (ie D:\Code\ProjectOne)
I was able to solve this problem on my project by navigating to the files under the service reference then under Reference.svcmap. Select each one of them and change the build action from Content to none. These files aren't usually needed for the app so they don't need to be published.

Getting an error message when creating a new project from my template

I created a project template from an existing project, in this case it is just a resource DLL.
I replaced some of the data in the projects with the $projectname$ tags so that the contents and the file names take the value that I enter as the project name. When I create a new project from the template I see 2 dialog boxes, the first one seems to indicate success, i.e.
The operation completed successfully.
The second one indicate that there was an access violation, i.e.
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I press the OK button, the new project does not show up. I check the disk and only the project file (vcxproj) has been created, in this case it looks fine, no other files were created.
I checked the vcxproj file and it looks fine.
Other information:
I am using VS 2012
VS was started in administrator mode
The target location is my documents folder
Any idea?
//*eggbox
SolutionName.vcxproj file contains information about additional compiling files. All files which solution must compile must be located under same folder as SolutionName.vcxproj file.
It is very interesting issue which is correlated with next lines of vcxproj file
<ItemGroup>
<ClCompile Include="Example\AdditionCompiledFile.cpp" />
<ClCompile Include="ConsoleApplication1.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugMD|Win32'">Create</PrecompiledHeader>
</ClCompile>
The issue is reproduced on VS 2013 also.

Resources