简体   繁体   中英

Project Resources variable does not change value

I have an xslt file which I initially added to the "Resources" section of my project through the project properties. Inside of my program I call Resources.MyXsltFile to grab the string and I load it using XslCompiledTransform.Load . My program ran fine initially but after I updated the xslt file I noticed that my Resources.MyXsltFile was still using the original xslt contents and not my updated version. What's the deal?

It turns out that the compiled "Resources.Designer.cs" file that goes along with the 'Resources.resx' for the project does NOT get regenerated when you update one of the resource files. Therefore you have to regenerate the "Resources.Designer.cs" file manually. Here is an article from Marek Grzenkowicz which shows how to regenerate the file by right-clicking on "Resources.resx" and clicking on "Run custom tool". After that I ran my program and it finally used the updated version of my resource file.

另外,如果您不想使用自定义工具解决方案,请确保未在 Access Modifier的 “不生成代码”处使用资源。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM